Repository navigation
fix: support the WMF device ANSI code page - #24
Merged
ChristopherVR merged 1 commit intoOct 10, 2026
Merged
Conversation
Owner
|
Thanks for this — clean implementation, good test coverage (default charsets, explicit charsets, font names, byte advances, RestoreDC), and the 1252 fallback keeps existing behaviour intact. Merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WMF text with ANSI_CHARSET or DEFAULT_CHARSET is currently decoded as Windows-1252. The same WMF can contain different text when Windows replays it on a device with another ANSI code page. LOGFONT face names also use that device code page, independently of the font's text charset.
Add the optional
wmfAnsiCodePageplayback setting. It defaults to 1252 and accepts known code pages; callers can supply the source device'sGetACP()value. Explicit text charsets, Symbol text and EMF text keep their existing decoding. Preserve byte advances after multibyte decoding, including UTF-8 BOMs, and decode bounded ANSI font names with the same device setting. The converter does not infer an encoding from file bytes or browser language.Validation: all 6,800 tests across 202 files passed, plus type checking, package builds and the browser-package check. Synthetic WMF tests cover both default charsets, explicit charsets, font names, byte advances, SaveDC/RestoreDC and malformed input. Independent Windows
MultiByteToWideChar,CreateFontIndirectA/GetObjectWand text-extent checks confirmed the code-page behavior. No private documents are included.