I have a Problem, with every font i add with addTTFfont() is just deletes my
umlaute.
So from a String "für" i get "fr" as output.
I have used several fonts, also arial witch has those signs 100%
i used
$pdf->addTTFfont(mypath/lte50259.ttf');
$pdf->addTTFfont(mypath/lte50259.ttf', 'TreuType');
$pdf->addTTFfont(mypath/lte50259.ttf', 'TrueTypeUnicode');
and so further... but nothing worked.
if i use uft8_encode() for the string i want to output, i get "fˆ…r".
if i use uft8_decode() for the string i want to output, the whole string gets
kinda erased.
Does anyone know how to solve this problem, because i don't find anything
helpful in the documentation of TCPDF.
:D
i hope i get a fast resolve
:D
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First try using the default fonts. If everything is OK, then try to use your
custom font.
If you have problems, then you have to check your font using FontForge or
replace it with a better one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FontForge is an advanced tool for editing fonts. It can be complicate to use
for a novice.
Probably your font is not correctly encoded or is not even an UTF-8 font.
The easiest way is to find an alternative UTF-8 font.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FWIW, I use custom fonts containing an extensive selection of diacritics
without problems (at least using any recent version of TCPDF). While I'm sure
that there are many "paths" to getting working diacritics, I use TrueType
fonts with Unicode encoding (platform id 0, encoding id 3 in the call to
addTTFfont()). I use FontForge extensively to modify and extend these fonts.
Other than the fact that FontForge is fairly buggy, it all works quite well.
In addition to FontForge, consider adding ttx to your toolbox. I find it
much easier to examine and manipulate things like CMAPs using a plain text
editor.
As you haven't really described in any detail what your problem is, it's hard
to know where to point you. But I would strongly suggest that you dig in
considerably further into the details. Use the source, Luke!
Some suggestions: (a) look at the generated PHP file for your font and see
that it looks reasonable, especially is the the 'u diaeresis' character (code
point 252(10)) even in the file, (b) bring up the font in fontforge and check
the encoding of the characters you care about, have fontforge correct the
encoding as necessary.
If this page is
any indication, you may actually have a Windows TrueType font file. If my
memory serves, Microsoft has some unique encodings in their font files.
Perhaps that is related to your problem. Make sure that you are referring to
the right CMAP in the addTTFfont() call. The encoding you are using in your
PHP needs to agree with the encoding used in the CMAP that you load.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all, thx for the answers.
And sorry, I had sooooo much to do and just had no time to try it out.
My file is encoded as unicode utf-8 (i used Dreamweaver ).
My Font-File is encoded ISO-10646-1 (Unicode, BMP)
Here is a Picture using Fontforge to see the encoding.
Also on the Picture you can see that chars like ö,ü and as such are existing.
As code i use
This is a short version of my code.
The output i get is "ˆ…ˆ¶ˆ⁄ˆˆˆ"
The funny thing is with Arial if i encode is with ISO-10646-1, the output
works if i decode the string with utf8_decode().
The Arial i have from my windows fonts folder (arial.ttf) and if i open it
with fontforge it shows me the characters like äöü are existing and if i go to
"Encoding > Reencoding" it also shows me that the encoding is on ISO-10646-1.
So, both fonts have the same encoding, both have the special characters like
äöü i want to output, and yet it doesn't work with my lte50259_copy.ttf
Does someone know why? or is it really the ttf-file that is broken or
something.
The point is i HAVE to use that font (not that specific file, but the font
'Helvetive Neue').
Thx for the Answers :D
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Guys....
I have a Problem, with every font i add with addTTFfont() is just deletes my
umlaute.
So from a String "für" i get "fr" as output.
I have used several fonts, also arial witch has those signs 100%
i used
$pdf->addTTFfont(mypath/lte50259.ttf');
$pdf->addTTFfont(mypath/lte50259.ttf', 'TreuType');
$pdf->addTTFfont(mypath/lte50259.ttf', 'TrueTypeUnicode');
and so further... but nothing worked.
if i use uft8_encode() for the string i want to output, i get "fˆ…r".
if i use uft8_decode() for the string i want to output, the whole string gets
kinda erased.
Does anyone know how to solve this problem, because i don't find anything
helpful in the documentation of TCPDF.
:D
i hope i get a fast resolve
:D
does nobody has a solution for this problem? :(
First try using the default fonts. If everything is OK, then try to use your
custom font.
If you have problems, then you have to check your font using FontForge or
replace it with a better one.
With the default fonts, everything works fine.
When I use my custom font, the problems start.
How can i check my font using FontForge?
thx for the answer :)
FontForge is an advanced tool for editing fonts. It can be complicate to use
for a novice.
Probably your font is not correctly encoded or is not even an UTF-8 font.
The easiest way is to find an alternative UTF-8 font.
FWIW, I use custom fonts containing an extensive selection of diacritics
without problems (at least using any recent version of TCPDF). While I'm sure
that there are many "paths" to getting working diacritics, I use TrueType
fonts with Unicode encoding (platform id 0, encoding id 3 in the call to
addTTFfont()). I use FontForge extensively to modify and extend these fonts.
Other than the fact that FontForge is fairly buggy, it all works quite well.
In addition to FontForge, consider adding
ttx to your toolbox. I find it
much easier to examine and manipulate things like CMAPs using a plain text
editor.
As you haven't really described in any detail what your problem is, it's hard
to know where to point you. But I would strongly suggest that you dig in
considerably further into the details. Use the source, Luke!
Some suggestions: (a) look at the generated PHP file for your font and see
that it looks reasonable, especially is the the 'u diaeresis' character (code
point 252(10)) even in the file, (b) bring up the font in fontforge and check
the encoding of the characters you care about, have fontforge correct the
encoding as necessary.
If this page is
any indication, you may actually have a Windows TrueType font file. If my
memory serves, Microsoft has some unique encodings in their font files.
Perhaps that is related to your problem. Make sure that you are referring to
the right CMAP in the addTTFfont() call. The encoding you are using in your
PHP needs to agree with the encoding used in the CMAP that you load.
Hi guys
First of all, thx for the answers.
And sorry, I had sooooo much to do and just had no time to try it out.
My file is encoded as unicode utf-8 (i used Dreamweaver ).
My Font-File is encoded ISO-10646-1 (Unicode, BMP)
Here is a Picture using Fontforge to see the encoding.
Also on the Picture you can see that chars like ö,ü and as such are existing.
As code i use
This is a short version of my code.
The output i get is "ˆ…ˆ¶ˆ⁄ˆˆˆ"
The funny thing is with Arial if i encode is with ISO-10646-1, the output
works if i decode the string with utf8_decode().
The Arial i have from my windows fonts folder (arial.ttf) and if i open it
with fontforge it shows me the characters like äöü are existing and if i go to
"Encoding > Reencoding" it also shows me that the encoding is on ISO-10646-1.
So, both fonts have the same encoding, both have the special characters like
äöü i want to output, and yet it doesn't work with my lte50259_copy.ttf
Does someone know why? or is it really the ttf-file that is broken or
something.
The point is i HAVE to use that font (not that specific file, but the font
'Helvetive Neue').
Thx for the Answers :D
If the encoding of your editor is set to UTF-8 you should also initiate TCPDF
with it and not with ISO-10646-1.
what do you mean? should i change the encoding of my php file?...
or should i change
to
?
If you switch to UTF-8 everything will be more simpler.