riuson / lcd-image-converter

Tool to create bitmaps and fonts for embedded applications, v.2
https://lcd-image-converter.riuson.com/
GNU General Public License v3.0
337 stars 80 forks source link

descent parameter #42

Closed sumotoy closed 8 years ago

sumotoy commented 8 years ago

It's a request, not a bug!

It's possible access the 'descent' parameter from baseline in template? Like this: glyph_metrics_2x

riuson commented 8 years ago

So as it available in font metrics, then yes. But font's modification can change its to wrong value.

riuson commented 8 years ago

Tags fnt_descent and fnt_ascent added in rev. 07451b763aa7769554a547d348ca0aad46caee6e from 2016-06-07.

sumotoy commented 8 years ago

Wow! Thanks riuson, very useful!

sumotoy commented 8 years ago

font's modification can change its to wrong value.

You right. I've compiled https://github.com/riuson/lcd-image-converter/commit/07451b763aa7769554a547d348ca0aad46caee6e and tested. It works! I've noticed that optimixe height have strong impact on ascent/descent. Cutting pixel from top should subtract from ascent and from bottom to descent

riuson commented 8 years ago

Because after getting images for characters we have just images. Every image can be modified independently, by width and height. So common 'descent' property of source font become invalid.

sumotoy commented 8 years ago

I understand, even if I never touched a single height but I always use Optimize height... Can be useful detect single height change and drop the ascent/descent value to 0, as opposite (if no single height change detected) track the Optimize height... changes and update ascent/descent values? Like this it's possible use ascent/descent when one of the 2 values is not 0.

riuson commented 8 years ago

I think it's possible. But you have to wait much longer time than that taken by implementation of previous feature.

sumotoy commented 8 years ago

No rush riuson, this app is still the best one I ever find! I'm actually including link in all display libraries!

riuson commented 8 years ago

Try compile branch feature-operations, revision 153bc449d399ea94ae1afa303e1b32e794d0f012 . Ascent/descent are common for entire font. Can be modified by font resize/minimize height. Not affected by functions in image menu.

sumotoy commented 8 years ago

Amazing! Thanks, I will try this afternoon, can't wait!

riuson commented 8 years ago

I have uploaded compiled binary rev. aeaec30c605c26a2120fc3fd7643d96b8050e187 from 2016-06-27.

sumotoy commented 8 years ago

You got it! It works! Obviously it doesn't work for old stored fonts but I have converted new one and it works! I have tried optimized height and correctly updated descent-ascent! Did you save the original font ascent/descent data in the saved font file? (NOT the converted one, I know it's present)

riuson commented 8 years ago

Obviously it doesn't work for old stored fonts

Existing fonts may have a modified height that makes assumptions about the value of these properties is useless. Otherwise, it would be possible to take them out of the font metrics.

Did you save the original font ascent/descent data in the saved font file?

I save only current (modified) data in xml font file:

    <size>-1</size>
    <ascent>12</ascent>
    <descent>3</descent>
    <style>Normal</style>

This values can be changed with font resize/minimize. So it is not original values of the font.