Repository navigation
fix(docx): read a shipped face's line in whichever case a run spells its name - #1089
Merged
Merged
Conversation
…its name A family given up because another family already ships a face set under its wordFamily() is set in the holder's faces whichever case its runs spell the name in: measured in Word 16 on a document declaring the name once, runs spelled in upper and in lower case were drawn from the holder's program at its width and on its line. DocxShippedLines kept each face's line, and its file for the glyph check, under the exact spelling, so such a run read no line and its paragraph was held exact where the holder's spelling could grow to a least line: two registrations of Lato Regular at 14pt wrote 336 atLeast for FoldShared and 336 exact for FOLDSHARED and foldshared. The three maps are now ordered with String.CASE_INSENSITIVE_ORDER, the folding of the equalsIgnoreCase that DocxFontTable decides a shared name with, independent of the default locale. A run naming a shipped name in another case reads that face's line where the face fills the slot, and none where it leaves the slot empty. LibreOffice was not measured on this shape.
DocxShippedLines now names the exception the CHANGELOG and the capability details give: where the editor has a font of the name itself, its own font wins. DocxFontTable's account of where a given-up family's runs are set says both editors where the runs spell the holder's name, and Word 16 where they spell it in another case. The marker test says the marker follows the same lookup and was not measured itself, and the details name the pair whose every route writes the measured height.
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.
Why
A family whose
wordFamily()asks for a name another family already ships a face set under is givenup whole (
DocxFontTable.declaring, which compares names withequalsIgnoreCasebecause botheditors were measured to draw a run from a face set declared under its name in another case, in a
document declaring both spellings). Its runs are then set in the holder's faces, whichever case they
spell the name in — measured again here in Word 16 on the shape the refusal leaves, one element in
the holder's spelling: with
ProbeShareddeclared for Lato, runs spelledPROBESHAREDandprobesharedwere drawn from the same embedded Lato subset as the holder's, 130.96pt wide with theirtop at 37.50pt in all three spellings, where a control declaring IBM Plex Mono under its own name drew
176.47pt. LibreOffice was not measured: the local 26.8 drew none of the embedded faces in these
documents, the holder's included, and the 24.2 build CI runs is not available here. The exception that
stood before stands: where the editor has a font of that name itself, its own font wins.
DocxShippedLineskept each shipped face's line, and its file for the character-map check, under theexact spelling. So a given-up family spelling the name in another case read no line. For two
registrations of one face, its paragraph was then held to an exact height where one spelling the name
the holder's way grew to a least one. Measured on two registrations of Lato Regular at 14pt, declared
FoldShared:wordFamilyFoldShared336 atLeast336 atLeastFOLDSHARED336 exact336 atLeastfoldshared336 exact336 atLeast(The
FoldSharedrow writes no font on its run, the document's default face being that name, so itis read through the default; the other two through the run's own spelling.)
What changed
DocxShippedLineskeys its three maps (lines,files,characters) withString.CASE_INSENSITIVE_ORDER, which folds a character the wayequalsIgnoreCasedoes — thecomparison
DocxFontTabledecides a shared name with — and does not depend on the default locale.One family is written per name so compared, so no two faces can meet over a key.
one that shipped nothing of its own. A given-up family's paragraphs read the holder's line where
the holder filled the slot, in any case, and none where the holder left the slot empty: two answers
decided by the slot, where the spelling used to decide as well.
DocxShippedLinesjavadoc, the capability details' DOCX font entry and the CHANGELOG say so,including the exception that stands: where the editor has a font of that name itself, its own font
wins.
No public API changes. The 105-document corpus exports unchanged, part for part, with the same 1,718 notes: no
document in it spells a shipped name in another case.
Tests
DocxSharedFontNameTest.aGivenUpFamilyReadsTheHoldersLineWhicheverCaseItSpellsTheNameIn: thetable above. Before the change it failed with
[336 atLeast, 336 exact, 336 exact].DocxGrownLinesTest.aWordListsMarkerSpellingItsFaceInAnotherCaseIsReadInThatFace: a listmarker whose level spells
LATOorlatoover a shippedLatoreads the same reach as onespelling
Lato— the line and the character map both, the other case asked first so the face'sfile is read under it.
aGivenUpFamilySpelledAnotherWayClaimsNoLineOfItsOwn, renamedaGivenUpFamilySpelledInAnotherCaseReadsTheHoldersLine, keeps its result (364 exact, Latoholder, IBM Plex Mono given up as
CASESHARED): it now reads the holder's line, which that pairholds exact.
map keyed by exact spelling again (the marker test fails, asking the other case first so the
face's file is read under it). The character-map cache is not sabotaged separately.