Saturday, 14 September 2013

Font layout algorithm, Win32

Font layout algorithm, Win32

I'm trying to come up with a platform independent way to render unicode
text to some platform specific surface, but assuming that most platforms
support something at least kinda similar, maybe we can talk in terms of
the win32 API. I'm most interested in rendering LARGE buffers and
supporting rich text, so while I definitely don't want to ever look inside
a unicode buffer, I'd like to be told myself what to draw and be hinted
where to draw it, so if the buffer is modified, I might properly ask for
updates on partial regions of the buffer.
So the actual questions. GetTextExtentExPointA clearly allows me to get
the widths of each character, how do I get the width of a nonbreaking
extent of text? If I have some long word, he should probably be put on a
new line rather than splitting the word. How can I tell where to break the
text? Will I need to actually look inside the unicode buffer? This seems
very dangerous. Also, how do I figure how far each baseline should be
while rendering?
Finally, this is already looking like it's going to be extremely
complicated. Are there alternative strategies for doing what I'm trying to
do? I really would not at all like to rerender a HUGE buffer each time I
change tiny chunks of it. Something between looking at individual glyphs
and just giving a box to spat text in.

No comments:

Post a Comment