[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft] FW: Re: Freetype2 returns different descender value after upgrading
From: |
선민호 |
Subject: |
[ft] FW: Re: Freetype2 returns different descender value after upgrading 2.6.x to 2.8.x |
Date: |
Mon, 09 Apr 2018 19:45:05 +0900 |
Hello.
So sorry. I use company email system so I'm not sure I can send mail as
plain text...
First, winset is kind of UI element like button. In this case, to
display text, we use text winset.
Developer can set what text will be shown and its height, width, font
size, etc.
In our text winset, there is a code to prevent text overflow.
Text overflow means that the bitmap from freetype is bigger than winset
size.
This can be happend when developer sets bigger font size than winset
size.
== Sample App code
=======================================================================
=
TextLabel label = TextLabel::New("It is text winset");
label.SetSize( 200, 30 ); // Height is 30px
label.SetProperty( TextLabel::Property::PIXEL_SIZE, 36 ); // Font size
is 36px. It is bigger than winset size so text can be overflowed.
=======================================================================
=================
In this case, we change text to "...". ( Generally, we said this
Ellipsis )
To check bitmap from freetype is bigger than winset size, we compare
sum of ascender and descender with winset height.
== Code in our framework ====================================
FT_Size_Metrics& ftMetrics = ftFace->size->metrics;
const bool ellipsis = ( ( ftMetrics.ascender- ftMetrics.descender >
winset.height );
=======================================================
I wonder ascender-descender is proper value for this work.
I hope my explains help you understand my current situation.
Best Regards,
Minho.
--------- Original Message ---------
Sender : Werner LEMBERG <address@hidden>
Date : 2018-04-09 17:52 (GMT+9)
Title : Re: [ft] Freetype2 returns different descender value after
upgrading 2.6.x to 2.8.x
[Please write your e-mail as plain text, not HTML.]
> We use sum of ascender and descender to determine glyph size is over
> winset size or not. If it is over winset size, we make inner text
> to "...".
I don't understand this. Please provide an example together with
(small!) images that shows what you mean.
> My question is, to determine overflow, which value is most proper
> value? There are many kinds of value which represent "height" in
> freetype2. For example, ascender and descender, yMin and yMax,
> height.
>
> I read documents over and over but it is so hard to say which value
> is proper for this. Could you share your opinion?
It really depends on what you want to do...
Werner
[cid:cafe_image_0@s-core.co.kr]
[update?userid=minho.sun&do=bWFpbElEPTIwMTgwNDA5MTA0NTA1ZXBjbXMxcDJjYzA
zM2FlODI0M2IzM2I2NDJmODBiZjQ1OTA4YzE3MiZyZWNpcGllbnRBZGRyZXNzPWZyZWV0eX
BlQG5vbmdudS5vcmc_]