freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] How to render glyphs with baseline offset


From: Wojciech Mamrak
Subject: Re: [ft] How to render glyphs with baseline offset
Date: Sun, 17 Mar 2013 01:04:42 +0100

you can find some alternatives on [1].

Werner, is harfbuzz a text shaping engine [2], or text layout engine
as well [1]?
Even if the latter is the case, does it support text rotations, as
mentioned in the OP?

[1] http://en.wikipedia.org/wiki/Complex_text_layout
[2] http://en.wikipedia.org/wiki/HarfBuzz


2013/3/17 pvh1987 <address@hidden>:
>
> Thanks for your response.
>
> That Harfbuzz library sounds interesting. I will look into that. The lack of
> documentation might not be a problem if the library is easy to use :-) I
> will give it a try.
>
>
> Werner LEMBERG wrote:
>>
>>
>>> However, I find the library totally NOT intuitive, since I am a C++
>>> developer and not very used to low level C libraries.
>>
>> Suggestions for improvements of the documentation (or even patches)
>> are highly welcomed!
>>
>>> So, now, here is my main problem at the moment: When I set the pen
>>> coordinates like this:
>>>
>>>   pen.x = posx*64;
>>>   pen.y = (height-posy)*64;
>>>
>>> where (posx, posy) are the pixel coordinates on the wxDC and height
>>> are the font size (in points!), the text is drawed so the leftmost
>>> point on the baseline of the first glyph is at (posx, posy).
>>> Instead, I would like it to draw the text so (posx, posy) is the
>>> upper-left point of the bounding box of the font face.  And rotation
>>> has to be around this point as well.  How can I do that?  I spent
>>> hours, hours and hours to make some kind of offset to pen.y, but it
>>> is never just right when taking different DPI's and rotation into
>>> account.
>>
>> The only solution is to get an exact bbox of a character string is to
>> let FreeType compute all outlines at the given ppem value (this data
>> should be cached).  I strongly recommend to use a higher-level library
>> like Harfbuzz which does this job for you, and which also takes care
>> of advanced typographical stuff.
>>
>>> My second question is, to render single line, rotated "rich text",
>>> that is text that is using different font faces (normal, italic),
>>> different weight (regular, bold), underline, overline, subscript and
>>> superscript, can I use FreeType to do this directly?  If not, I
>>> guess it can do the job, but I will do better (and faster) with a
>>> library that already supports this. So, what library is that?  It
>>> has to be cross-platform (Windows, Mac OS X, Linux and so on) and of
>>> course, well supported and easy to use.
>>
>> Again: Harfbuzz.  You will be certainly delighted to hear that there
>> is *no* documentation yet of this library :-) However, its demo and
>> test programs are written in C++.
>>
>>
>>     Werner
>>
>> _______________________________________________
>> Freetype mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/freetype
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/How-to-render-glyphs-with-baseline-offset-tp35179767p35183391.html
> Sent from the Freetype - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Freetype mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/freetype



reply via email to

[Prev in Thread] Current Thread [Next in Thread]