TLabel: Autosize error with some UTF8 glyphs lazarus / 31-LCL ---------------------------------------------------------------------- winni · 2019-10-18 10:09 Hi! I stumbled again over this error: Label with autosize on Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Label1.caption :=' ⃤'; This is Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i U+20E4  /  ⃤  /  E283A4  / 14844836  /  COMBINING ENCLOSING UPWARD POINTING TRIANGLE  The glyph is positioned far too much left as shown in the attached screenshot. The same error appears if I show the triangle in a TComponent.hint. And if I do some canvas routines to draw text with tacenter the glyph appears  too much left. Is this error known? Winni PS The forum editor does a better job! ---------------------------------------------------------------------- winni · 2019-10-18 10:25 Ooops,forgot: Linux64 , fpc 3.04, Laz 2.04, gtk2 ---------------------------------------------------------------------- jamie · 2019-10-19 15:37 Please test that glyph on the TextWidth call of the canvas and see what value it reports. ---------------------------------------------------------------------- Martin_fr · 2019-10-19 15:44 If this is a "combining" codepoint, should it then not have something to combine with? Maybe put a space in front of it? ---------------------------------------------------------------------- jamie · 2019-10-19 16:31 I am thinking that maybe a negative value is being returned for some reason with the TextWidth call ? ---------------------------------------------------------------------- winni · 2019-10-19 16:33 Hi! The triangle has the width=0.Lol. Whatever happend there. Made a mini log (jamie) and added a space in front (Martin_fr). The result: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i U+20E4:    ⃤Liberation Sans boldFont.size: 10Char(s) Width: 0Char(s) Height: 20  Added leading #32 U+20E4:     ⃤Liberation Sans boldFont.size: 10Char(s) Width: 3Char(s) Height: 20  If you put 3 or 4 spaces in Front and behind it is not cuted. But that is no solution. Who determines the textextent.cx? First the TTF file and then it is resized. So where to search for the error? Winni ---------------------------------------------------------------------- winni · 2019-10-19 16:50 Hi! I just tested 25..30 different TTF fonts. But always the same result: The width of the triangle is zero. Now I will  test some other applications. Winni ---------------------------------------------------------------------- winni · 2019-10-19 17:09 Hi! Just tested some apps with the "Triangle-Zero-Length-Error". Libre Office writer: Error Thunderbird: Error Kate: OK Inkscape: Error Forum Editor: OK Lazarus is not alone! Winni ---------------------------------------------------------------------- winni · 2019-10-19 20:12 Hi! Mystery solved. UTF-8 is not so easy. I found the related block for the    ⃤  . It is "U+20D0..U+20FF Combining Diacritical Marks for Symbols". All this glyphs have a width = 0. They are intended not to move forward while writing like the "dead letters" on the keyboard. In total there are more than 800 of this diacritical marksin UTF-8, not only for french but thai, mongolian, hebrew, arabian kyrilic and other languages. So the label and the hint should be aware of the width=0 and place the char correct. So kate and the forum editor are wrong. And the other apps are right. Thanx for your help. Winni ---------------------------------------------------------------------- jamie · 2019-10-19 23:23 Ok, so that makes sense but still, shouldn't it be to the left and not off the chart ? ---------------------------------------------------------------------- winni · 2019-10-19 23:56 Hi! Yes jamie, the glyphs should be at their positions. The french circonflex should be centered over a small letter and so on. If no other letter is present they should be adjusted left. I have a guess. The very most of this diacritical marks are very small signs like ' ` ´ But the triangle has in - monospaced terms - the double width. So perhaps someone in the LCL code relied that all those signs are only "dust" and not double width?! Winni ---------------------------------------------------------------------- Martin_fr · 2019-10-20 08:21 Quote from: winni on October 19, 2019, 10:12:58 pmMystery solved. UTF-8 is not so easy. I found the related block for the    ⃤  . It is "U+20D0..U+20FF Combining Diacritical Marks for Symbols". All this glyphs have a width = 0. They are intended not to move forward while writing like the "dead letters" on the keyboard. Hence I pointed out "combining". It may depend on the font what exactly it can combine with... I would have expected it to combine with a space. But then it may not.