Page 1 of 1

IGUIFont supported not user defined font for german umlauts

Posted: Tue Feb 13, 2018 5:00 pm
by Gruftsocke
Hello everybody.
have a little question about IGUIFont.
When I load a font, which was created by the font tool, which included in Irrlicht-SDK, I can not spend German umlauts.
But if I do not load an external font and use the default font, which is created when irrlicht will initialized, than is possible to spend German umlauts (ÄÜÖäüö and so on).

Is there already a solution to this?

Re: IGUIFont supported not user defined font for german umla

Posted: Tue Feb 13, 2018 6:43 pm
by CuteAlien
Bitmap font? Check the bitmap itself if it contains the umlauts. Maybe you can post the bitmaps here so we can check if something is wrong.

Re: IGUIFont supported not user defined font for german umla

Posted: Tue Feb 13, 2018 7:28 pm
by Gruftsocke
Yes a bitmap font.
Here's the bitmap I'm using.
Image
here the xml-file:

Code: Select all

<?xml version="1.0" encoding="UTF-16LE"?>
 
<font type="bitmap">
 
    <Texture index="0" filename="ms_sans_serif_b9px0.bmp" hasAlpha="false" />
 
    <c c=" " r="0, 0, 4, 13" />
    <c c="!" r="5, 0, 9, 13" />
    <c c=""" r="10, 0, 16, 13" />
    <c c="#" r="17, 0, 25, 13" />
    <c c="$" r="26, 0, 33, 13" />
    <c c="%" r="34, 0, 43, 13" />
    <c c="&" r="44, 0, 51, 13" />
    <c c="'" r="52, 0, 55, 13" />
    <c c="(" r="56, 0, 60, 13" />
    <c c=")" r="61, 0, 65, 13" />
    <c c="*" r="66, 0, 71, 13" />
    <c c="+" r="72, 0, 79, 13" />
    <c c="," r="80, 0, 84, 13" />
    <c c="-" r="85, 0, 89, 13" />
    <c c="." r="90, 0, 94, 13" />
    <c c="/" r="95, 0, 101, 13" />
    <c c="0" r="102, 0, 109, 13" />
    <c c="1" r="110, 0, 117, 13" />
    <c c="2" r="118, 0, 125, 13" />
    <c c="3" r="126, 0, 133, 13" />
    <c c="4" r="134, 0, 141, 13" />
    <c c="5" r="142, 0, 149, 13" />
    <c c="6" r="150, 0, 157, 13" />
    <c c="7" r="158, 0, 165, 13" />
    <c c="8" r="166, 0, 173, 13" />
    <c c="9" r="174, 0, 181, 13" />
    <c c=":" r="182, 0, 186, 13" />
    <c c=";" r="187, 0, 191, 13" />
    <c c="<" r="192, 0, 199, 13" />
    <c c="=" r="200, 0, 207, 13" />
    <c c=">" r="208, 0, 215, 13" />
    <c c="?" r="216, 0, 223, 13" />
    <c c="@" r="224, 0, 236, 13" />
    <c c="A" r="237, 0, 245, 13" />
    <c c="B" r="246, 0, 254, 13" />
    <c c="C" r="0, 14, 8, 27" />
    <c c="D" r="9, 14, 18, 27" />
    <c c="E" r="19, 14, 27, 27" />
    <c c="F" r="28, 14, 35, 27" />
    <c c="G" r="36, 14, 45, 27" />
    <c c="H" r="46, 14, 55, 27" />
    <c c="I" r="56, 14, 60, 27" />
    <c c="J" r="61, 14, 67, 27" />
    <c c="K" r="68, 14, 76, 27" />
    <c c="L" r="77, 14, 84, 27" />
    <c c="M" r="85, 14, 95, 27" />
    <c c="N" r="96, 14, 105, 27" />
    <c c="O" r="106, 14, 115, 27" />
    <c c="P" r="116, 14, 124, 27" />
    <c c="Q" r="125, 14, 134, 27" />
    <c c="R" r="135, 14, 144, 27" />
    <c c="S" r="145, 14, 153, 27" />
    <c c="T" r="154, 14, 162, 27" />
    <c c="U" r="163, 14, 172, 27" />
    <c c="V" r="173, 14, 181, 27" />
    <c c="W" r="182, 14, 194, 27" />
    <c c="X" r="195, 14, 203, 27" />
    <c c="Y" r="204, 14, 212, 27" />
    <c c="Z" r="213, 14, 221, 27" />
    <c c="[" r="222, 14, 226, 27" />
    <c c="\" r="227, 14, 233, 27" />
    <c c="]" r="234, 14, 238, 27" />
    <c c="^" r="239, 14, 246, 27" />
    <c c="_" r="247, 14, 254, 27" />
    <c c="`" r="0, 28, 4, 41" />
    <c c="a" r="5, 28, 12, 41" />
    <c c="b" r="13, 28, 20, 41" />
    <c c="c" r="21, 28, 28, 41" />
    <c c="d" r="29, 28, 36, 41" />
    <c c="e" r="37, 28, 44, 41" />
    <c c="f" r="45, 28, 49, 41" />
    <c c="g" r="50, 28, 57, 41" />
    <c c="h" r="58, 28, 65, 41" />
    <c c="i" r="66, 28, 69, 41" />
    <c c="j" r="70, 28, 73, 41" />
    <c c="k" r="74, 28, 81, 41" />
    <c c="l" r="82, 28, 85, 41" />
    <c c="m" r="86, 28, 95, 41" />
    <c c="n" r="96, 28, 103, 41" />
    <c c="o" r="104, 28, 111, 41" />
    <c c="p" r="112, 28, 119, 41" />
    <c c="q" r="120, 28, 127, 41" />
    <c c="r" r="128, 28, 132, 41" />
    <c c="s" r="133, 28, 139, 41" />
    <c c="t" r="140, 28, 144, 41" />
    <c c="u" r="145, 28, 152, 41" />
    <c c="v" r="153, 28, 160, 41" />
    <c c="w" r="161, 28, 170, 41" />
    <c c="x" r="171, 28, 177, 41" />
    <c c="y" r="178, 28, 184, 41" />
    <c c="z" r="185, 28, 191, 41" />
    <c c="{" r="192, 28, 197, 41" />
    <c c="|" r="198, 28, 201, 41" />
    <c c="}" r="202, 28, 207, 41" />
    <c c="~" r="208, 28, 216, 41" />
    <c c="" r="217, 28, 221, 41" />
    <c c="" r="222, 28, 222, 41" />
    <c c="" r="223, 28, 223, 41" />
    <c c="" r="224, 28, 224, 41" />
    <c c="" r="225, 28, 225, 41" />
    <c c="" r="226, 28, 226, 41" />
    <c c=" " r="227, 28, 231, 41" />
    <c c="¡" r="232, 28, 236, 41" />
    <c c="¢" r="237, 28, 244, 41" />
    <c c="£" r="245, 28, 252, 41" />
    <c c="¤" r="0, 42, 7, 55" />
    <c c="¥" r="8, 42, 15, 55" />
    <c c="¦" r="16, 42, 19, 55" />
    <c c="§" r="20, 42, 27, 55" />
    <c c="¨" r="28, 42, 32, 55" />
    <c c="©" r="33, 42, 43, 55" />
    <c c="ª" r="44, 42, 49, 55" />
    <c c="«" r="50, 42, 57, 55" />
    <c c="¬" r="58, 42, 65, 55" />
    <c c="­" r="66, 42, 70, 55" />
    <c c="®" r="71, 42, 80, 55" />
    <c c="¯" r="81, 42, 88, 55" />
    <c c="°" r="89, 42, 94, 55" />
    <c c="±" r="95, 42, 102, 55" />
    <c c="²" r="103, 42, 107, 55" />
    <c c="³" r="108, 42, 112, 55" />
    <c c="´" r="113, 42, 117, 55" />
    <c c="µ" r="118, 42, 125, 55" />
    <c c="¶" r="126, 42, 133, 55" />
    <c c="·" r="134, 42, 138, 55" />
    <c c="¸" r="139, 42, 143, 55" />
    <c c="¹" r="144, 42, 148, 55" />
    <c c="º" r="149, 42, 154, 55" />
    <c c="»" r="155, 42, 162, 55" />
    <c c="¼" r="163, 42, 172, 55" />
    <c c="½" r="173, 42, 182, 55" />
    <c c="¾" r="183, 42, 192, 55" />
    <c c="¿" r="193, 42, 200, 55" />
    <c c="À" r="201, 42, 209, 55" />
    <c c="Á" r="210, 42, 218, 55" />
    <c c="Â" r="219, 42, 227, 55" />
    <c c="Ã" r="228, 42, 236, 55" />
    <c c="Ä" r="237, 42, 245, 55" />
    <c c="Å" r="246, 42, 254, 55" />
    <c c="Æ" r="0, 56, 11, 69" />
    <c c="Ç" r="12, 56, 20, 69" />
    <c c="È" r="21, 56, 29, 69" />
    <c c="É" r="30, 56, 38, 69" />
    <c c="Ê" r="39, 56, 47, 69" />
    <c c="Ë" r="48, 56, 56, 69" />
    <c c="Ì" r="57, 56, 61, 69" />
    <c c="Í" r="62, 56, 66, 69" />
    <c c="Î" r="67, 56, 71, 69" />
    <c c="Ï" r="72, 56, 76, 69" />
    <c c="Ð" r="77, 56, 86, 69" />
    <c c="Ñ" r="87, 56, 96, 69" />
    <c c="Ò" r="97, 56, 106, 69" />
    <c c="Ó" r="107, 56, 116, 69" />
    <c c="Ô" r="117, 56, 126, 69" />
    <c c="Õ" r="127, 56, 136, 69" />
    <c c="Ö" r="137, 56, 146, 69" />
    <c c="×" r="147, 56, 154, 69" />
    <c c="Ø" r="155, 56, 164, 69" />
    <c c="Ù" r="165, 56, 174, 69" />
    <c c="Ú" r="175, 56, 184, 69" />
    <c c="Û" r="185, 56, 194, 69" />
    <c c="Ü" r="195, 56, 204, 69" />
    <c c="Ý" r="205, 56, 213, 69" />
    <c c="Þ" r="214, 56, 222, 69" />
    <c c="ß" r="223, 56, 230, 69" />
    <c c="à" r="231, 56, 238, 69" />
    <c c="á" r="239, 56, 246, 69" />
    <c c="â" r="247, 56, 254, 69" />
    <c c="ã" r="0, 70, 7, 83" />
    <c c="ä" r="8, 70, 15, 83" />
    <c c="å" r="16, 70, 23, 83" />
    <c c="æ" r="24, 70, 35, 83" />
    <c c="ç" r="36, 70, 43, 83" />
    <c c="è" r="44, 70, 51, 83" />
    <c c="é" r="52, 70, 59, 83" />
    <c c="ê" r="60, 70, 67, 83" />
    <c c="ë" r="68, 70, 75, 83" />
    <c c="ì" r="76, 70, 79, 83" />
    <c c="í" r="80, 70, 85, 83" />
    <c c="î" r="86, 70, 91, 83" />
    <c c="ï" r="92, 70, 97, 83" />
    <c c="ð" r="98, 70, 105, 83" />
    <c c="ñ" r="106, 70, 113, 83" />
    <c c="ò" r="114, 70, 121, 83" />
    <c c="ó" r="122, 70, 129, 83" />
    <c c="ô" r="130, 70, 137, 83" />
    <c c="õ" r="138, 70, 145, 83" />
    <c c="ö" r="146, 70, 153, 83" />
    <c c="÷" r="154, 70, 161, 83" />
    <c c="ø" r="162, 70, 169, 83" />
    <c c="ù" r="170, 70, 177, 83" />
    <c c="ú" r="178, 70, 185, 83" />
    <c c="û" r="186, 70, 193, 83" />
    <c c="ü" r="194, 70, 201, 83" />
    <c c="ý" r="202, 70, 208, 83" />
    <c c="þ" r="209, 70, 216, 83" />
    <c c="ÿ" r="217, 70, 223, 83" />
    <c c="Œ" r="224, 70, 228, 83" />
    <c c="œ" r="229, 70, 233, 83" />
    <c c="Š" r="234, 70, 238, 83" />
    <c c="š" r="239, 70, 243, 83" />
    <c c="Ÿ" r="244, 70, 248, 83" />
    <c c="Ž" r="249, 70, 253, 83" />
    <c c="ž" r="0, 84, 4, 97" />
    <c c="ƒ" r="5, 84, 9, 97" />
    <c c="ˆ" r="10, 84, 14, 97" />
    <c c="˜" r="15, 84, 19, 97" />
    <c c="–" r="20, 84, 24, 97" />
    <c c="—" r="25, 84, 29, 97" />
    <c c="‘" r="30, 84, 34, 97" />
    <c c="’" r="35, 84, 39, 97" />
    <c c="‚" r="40, 84, 44, 97" />
    <c c="“" r="45, 84, 49, 97" />
    <c c="”" r="50, 84, 54, 97" />
    <c c="„" r="55, 84, 59, 97" />
    <c c="†" r="60, 84, 64, 97" />
    <c c="‡" r="65, 84, 69, 97" />
    <c c="•" r="70, 84, 74, 97" />
    <c c="…" r="75, 84, 79, 97" />
    <c c="‰" r="80, 84, 84, 97" />
    <c c="‹" r="85, 84, 89, 97" />
    <c c="›" r="90, 84, 94, 97" />
    <c c="€" r="95, 84, 102, 97" />
    <c c="™" r="103, 84, 107, 97" />
</font>
In the source code of the file CGUIFont.cpp in line 126 there is a method "xml-> getAttributeValue (L" c ") [0]" and when reading the umlauts the first index is not a valid character.
But I've added the following code for debugprint below line 126:

Code: Select all

 
//! loads a font file from xml
bool CGUIFont::load(io::IXMLReader* xml)
{
...
// for debug print
core::stringw _inc = xml->getAttributeValue(L"c");
if (_inc.size() > 1)
    ch = _inc[(_inc.size() - 1)];
wprintf(L"character c='%c' org str: %s\n", ch, _inc.c_str());
...
}
 
If I get the last character from the string, the character is correct, but it is not drawn on the screen.
And same thing in line 369:

Code: Select all

 
void CGUIFont::readPositions(video::IImage* image, s32& lowerRightPositions)
{
...
// map letter to character
wchar_t ch = (wchar_t)(lowerRightPositions + 32);
wprintf(L"Imagepasing ch='%c' pos[%i]\n", ch, lowerRightPositions); // << from me, debug print
CharacterMap.set(ch, lowerRightPositions);
...
}
 
I have already tried different fonts.
All have a same problem.

[EDIT]
I did not change anything on the source code.
This is the original Irrlicht SDK 1.8.4

Re: IGUIFont supported not user defined font for german umla

Posted: Tue Feb 13, 2018 10:18 pm
by CuteAlien
*sigh* I get different stuff in my copy-paste buffer depending on if I copy full lines from your paste or just part of the lines. I'll try if I can reproduce it myself here somehow.

But one one more question - how do you create the umlauts? Are you using the Irrlicht edit-box? Or do you load them from file? Or did you write them directly in c++ code? Also do you do other stuff like setting the locale (or open a file with file-open dialog, I think Irrlicht 1.8 still did change the local when doing that back then).

edit: As a quick test I started the BuildAllExamples project file. Run FontTool. Create MS Sans Serif with 9px and bold. Set Max Width to 256. Saved. Then changed example 5 I changed the line where it gets the fonhaettenschweiler.bmp to:

Code: Select all

 
IGUIFont* font = env->getFont("../../tools/IrrFontTool/newFontTool/myfont.xml");
 
I can enter umlauts then in the editbox there.

Re: IGUIFont supported not user defined font for german umla

Posted: Sun Feb 18, 2018 1:50 am
by Gruftsocke
Ok,
i have the irrlicht-sdk, the example-5 and the fonttool recomiled.
A new font created and with example-5 checked.
I took the same settings as you posted.
Now it's working.

Is something funny.

Ok, thanks for your help.