Hi Denis,
Denis Oliver Kropp wrote:
> Phil Endecott wrote:
>> I have thrown together some code for text rotation using FreeType2.
[snip]
>> I treat these rotation values as quarter-turns anti-clockwise,
>> 0<=rotation<=3. It would be straightforward to supply an arbitrary
>> angle to FreeType, but (a) I don't need it; (b) it would be much harder
>> to implement for any bitmap font providers, and (c) it could make the
>> DisplayString positioning stuff (see below) even more complex. If
>> people do want to allow an arbitrary rotation, we should consider going
>> further and allowing an arbitrary transformation.
>
> What about using degrees, but only allow 0, 90, 180 and 270?
Is there any mechanism for a font provider to indicate its
capabilities? i.e. FONT_CAPABILITY_ROTATE_RIGHTANGLE vs
FONT_CAPABILITY_ROATE_ARBITRARY?
Angles really need to be floating-point. Equality tests for
floating-point values are tricky.
[snip]
>> Unfortunately, there is more complexity; in particular there are the
>> string width calculating functions, and the logic for centering and
>> right-aligning text. I haven't even used most of this stuff. So: if a
>> user asks for the "width" of a string in a font that is rotated to be
>> vertical, what should they be told?
>
> I'd expect the vertical size, because I know the text is rotated and I
> break the text in vertical strips.
OK.
I think this means that I need to either compute or store
sqrt(sqr(xadvance)+sqr(yadvance)).
> For string extents with rectangle return values, it should have the same
> orientation as usual.
OK. Now think about a 45-degree rotation:
+---+
|F |
| o |
| o|
+---+
/\
\F\
\o\
\o\
\/
Does that return 3x3? Or should it actually be returning a
non-orthogonal box?
>> A couple of other areas where I had to make temporary hacks to get it
>> to compile are dgiff fonts and fixed_advance.
>
> A font could refuse to implement rotated text.
Ditto comment about FONT_CAPABILITES. Note that even FreeType will
refuse to apply a transformation if the font file it has read contains
a bitmap font.
> Hmm, wouldn't it be
> possible to do the rotation in generic code, but with probably more
> overhead at load time.
You could do it when copying the glyphs out of the cache, using a
rotating blit. (Have you made any more progress with that?)
>> If someone who better understands all of this would like to help out,
>> that would be much appreciated. Otherwise, some suggestions about how
>> it should all work would be useful.
>
> So far it looks good. Feel free to ask more questions.
There will be more! But if you (& anyone else) would like to offer a
checklist of things that I need to consider, that would be very
useful. There is a lot of the DirectFB code that I have never looked at.
Regards,
Phil.
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev