Repository navigation
Preserve BDF/PCF FONT_VERSION in bitmap font metadata - #5935
Conversation
|
This PR has too much useless code. Please limit it to fixing the actual bug. |
…erve-bdf-font-version
|
Binary blob |
| double dval; | ||
| int val, mant; | ||
| while ( *pt && !isdigit(*pt) && *pt!='.' ) ++pt; | ||
| while ( *pt && !isdigit((unsigned char) *pt) && *pt!='.' ) ++pt; |
There was a problem hiding this comment.
Why the cast of *pt to unsigned char?
| val = floor(dval); | ||
| mant = floor(65536.*(dval-val)); | ||
| head->revision = (val<<16) | mant; | ||
| /* Keep the default if the version does not fit a signed 16.16 value. */ |
There was a problem hiding this comment.
This will break reproducible builds for no good reason. Please revert.
| char *pt=sf->version; | ||
| char *end; | ||
| while ( *pt && !isdigit(*pt) && *pt!='.' ) ++pt; | ||
| while ( *pt && !isdigit((unsigned char) *pt) && *pt!='.' ) ++pt; |
|
Please rebase to the latest master to fix CI failures. |
|
Updated in ca46887. I merged the current master for the CI fixes and reverted the |
| setlocale(LC_NUMERIC,oldlocale); | ||
| free(oldlocale); | ||
| #else | ||
| locale_t tmplocale = NULL, oldlocale = NULL; |
There was a problem hiding this comment.
You need only this branch of #ifdef. switch_to_c_locale() and switch_to_old_locale() already contain the hack, it will act as appropriate in both cases.
|
Updated to use the shared locale helpers in 97721c6. All eight CI checks have passed. Thanks for reviewing! |
Fixes #1045
Opening a standalone BDF or PCF preserves a nonempty string
FONT_VERSIONin the font's version metadata. Importing a bitmap strike into an existing font leaves its version unchanged. Missing, empty, or line-breaking values retain the existing default.The shared TTF and WOFF export code is unchanged. For an imported label whose parsed numeric value cannot fit a signed 16.16 revision, the importer keeps the previous SFNT revision of 1.0 using the existing explicit
sfntRevisionfield. The label itself is preserved, including through SFD saves. If the label is later edited, the explicit revision can be cleared withfont.sfntRevision = None. WOFF retains its existing numeric-label conversion and 16-bit major/minor representation; no WOFF version override is added. Type 1 output streams long version strings and quotes parentheses and backslashes.Regression tests cover BDF/PCF opening, SFD round-trips, existing-font import, default/atom/Latin-1 values, PCF CR/LF values, long quoted Type 1 output, SFNT boundary/date/exponent/hex values, editing an explicit revision, and a UTF-8-prefixed WOFF version.
Updated to the current master CI fixes with a merge that preserves the branch history. Validation: a headless Linux build and complete CTest suite (129 passed, 23 skipped, zero failures). Targeted UBSan checks also passed in C and German numeric locales. Unrelated existing signed-reader shifts were excluded only in the diagnostic build. No Windows or GUI validation is claimed.