GreenPad icon indicating copy to clipboard operation
GreenPad copied to clipboard

Support scripts that have a context-dependant width like Devanagari

Open RamonUnch opened this issue 2 years ago • 1 comments

GreenPad's problem is that it always consider the length in pixels of a string to be equal to sum of the length of each character in the string. this has the advantage to be super simple and fast but gives some problems:

ie: the Hindi text here: मुक्त ज्ञानकोश विकिपीडिया से displays as: hindi the reason is vowels, instead of being completely separated characters can be combined with a consonant in the form of an accent. so for example the सेcharacter s actually made of two charcater: folowed by the combined vowel:, same for प+ ी+ड => पीड GreenPad just assumes the width of the string to include the size of each glyf in its 'isolated' form, so you can see the whole secret when selecting the string character by character: hindih

The same problem occurs with Arabic script, because its width of each character also depends on the context.

I think that the whole widthTable_[65536], character table system has to be ditched and everything has to be replaced by GetTextExtentPoint32W() calls. This would be much slower however so I am not sure it is worth it.

RamonUnch avatar Mar 29 '22 09:03 RamonUnch