Open lucasvickers opened 10 years ago
Remembered seeing this questions a while back and I was facing the same issue. There is a way to resolve this by using Gdiplus::StringFormat::GenericTypographic()
instead of the default gdi+ format. From https://support.microsoft.com/en-us/kb/307208:
The default action of DrawString works against you when you display adjacent runs: First, the default StringFormat object adds an extra 1/6 em at each end of each output; second, when grid fitted widths are less than designed, the rendered string is allowed to contract from its measured size by up to an em.
To avoid these problems, do the following: Always pass MeasureString and DrawString a StringFormat object based on the typographic StringFormat (GenericTypographic).
-and-
Set TextRenderingHint graphics to TextRenderingHintAntiAlias.
Since the code for that is private to TextLayout
, I don't know of any way to use the current APIs to fix this w/o going into TextLayout.cpp
itself.
Too much space above the text compared to the bottom ! I have difficult to center texture independtly of size !
I tryed Gdiplus::StringFormat::GenericTypographic() but nothing !
Perhaps the solution is to crop to transparency ?
I am relying on the TextLayout to provide left aligned text. My expectation is that the first pixel of text would be at the left most border of the returned texture.
1) I don't see this expectation fully met on OS X or on Windows. Is it possible to have TextLayout function in this manner? I was previously using gl::drawstring, but with the typeface I was using it was not rendering special characters. I was able to get Cairo to render the correct characters but Cairo comes with it's own set of complications.
2) I see some pretty drastic spacing inconsistencies between OS X + Windows, which is causing me some headaches in laying out designs.
Please let me know your thoughts. I noticed this on the Dev/Master windows branches.
Thanks
Windows Layout
OS X Layout
Code: