Page MenuHome

BLF Cleanup: Size Defines, Comments, etc
ClosedPublic

Authored by Harley Acheson (harley) on Aug 12 2021, 12:32 AM.

Details

Summary

This patch makes some non-functional changes to BLF code. Some size
defines added, comments changed.


Defines added for the sizes of GlyphCacheBLF.glyph_ascii_table, KerningCacheBLF.table, and for the first and last ascii characters that are rendered into the glyph cache.

A comment change to clarify that the format of the character in GlyphBLF is UTF-32, not UTF-8.

Removal of GlyphCacheBLF.glyphs_len_max and GlyphCacheBLF.glyphs_len_free, unreferenced and unneeded.

Simplification of macro BLF_KERNING_VARS:

FT macro FT_HAS_KERNING returns a bool, so no need to compare against 0.

kern_mode is a bit more complex. ft_kerning_default is deprecated, replaced by enum of same value: FT_KERNING_DEFAULT. But note that the value of FT_KERNING_DEFAULT is zero, which is what the function returns if not has_kerning. Therefore this function is always returning FT_KERNING_DEFAULT except when !has_kerning and flags not containing BLF_KERNING_DEFAULT, when it returns FT_KERNING_UNFITTED

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.Aug 12 2021, 12:32 AM
Harley Acheson (harley) created this revision.
Harley Acheson (harley) planned changes to this revision.Aug 12 2021, 1:30 AM

forgot a couple things...

Harley Acheson (harley) edited the summary of this revision. (Show Details)

more cleanup.

Campbell Barton (campbellbarton) requested changes to this revision.Aug 12 2021, 10:04 AM

blf_kerning_cache_new should replace 0x80 with GLYPH_ASCII_TABLE_SIZE.

source/blender/blenfont/intern/blf_font.c
360–364

This serves no purpose, if the intention is not to cache glyphs, that can be a separate patch.

source/blender/blenfont/intern/blf_internal_types.h
34

Note these values are inclusive.

This revision now requires changes to proceed.Aug 12 2021, 10:04 AM

@Campbell Barton (campbellbarton) - blf_kerning_cache_new should replace 0x80 with GLYPH_ASCII_TABLE_SIZE.

Ouch, missed that one. Thanks, fixed, using KERNING_CACHE_TABLE_SIZE.

Note these values are inclusive.

Yes, did so while reworking those comments a bit more.

This serves no purpose, if the intention is not to cache glyphs, that can be a separate patch

Yes, will do.

This revision is now accepted and ready to land.Aug 13 2021, 8:10 AM
Harley Acheson (harley) edited the summary of this revision. (Show Details)Aug 13 2021, 3:17 PM
This revision was automatically updated to reflect the committed changes.