RamonUnch / GreenPad

Fork from roytam1 fork from original GreenPad
21 stars 0 forks source link

Fix random TextOutW fails #166

Closed RamonUnch closed 9 months ago

RamonUnch commented 9 months ago

I finally found the reason TextOutW was failing in some cases... The reason was memory alignement. Because we allocate the line buffer like (alen+1)*2+alen the ORIGINAL memman does not always align the unicode data. in general this is not a problem but it seems TextOutW does not like that. The solution is to simply ensure we allocate an even number of bytes with mem().alloc() when we want to have an unicode string.

I did that in the Line struct...

When not using the ORIGINAL_MEMMAN we do not need that because HeapAlloc is already more aligned than needed.

@roytam1 you might be interested.