Naitik Desai
Naitik Desai

Reputation: 33

Custom Font is is only showing if font face is loaded

I am using hindi font on my CKeditor using font-face. So when I am typing on the textbox it is showing hindi fonts.

But it is because of font-face.So when I copy to another place it shows english font and thats not I want. I am trying to add the data in Hindi from a html "text field" to mysql database using the php script.

It is not inserting the hindi text, it is inserting the English fonts.

Upvotes: 2

Views: 611

Answers (2)

KyleK
KyleK

Reputation: 5056

Reinmar is right and you can also embed your font in your HTML with encoding it in base64:

<style type="text/css">
@font-face {
  font-family: 'hindi';
  src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgA...AAA==) format('woff'),
     url(data...) format('truetype');
  font-weight: normal;
  font-style: normal;
}
</style>
<p style="font-family: hindi;">Output of the editor</p>

Here you can copy it to another place but it is not optimized to render it on a webpage.

Upvotes: 1

Reinmar
Reinmar

Reputation: 22013

I have no experience with hindi language, so I don't know how it is usually stored in databases. But font face affects only how the text is rendered. It will not affect the way how data is stored, so normal ASCII characters will be the output of the editor. If you want to display on your website text in the same way that it was visible inside the editor you need to apply the same fonts on the target website.

Upvotes: 1

Related Questions