Feature: implement the truncating line break modes in the typesetter - #829
Open
DTW-Thalion wants to merge 2 commits into
Open
Feature: implement the truncating line break modes in the typesetter#829DTW-Thalion wants to merge 2 commits into
DTW-Thalion wants to merge 2 commits into
Conversation
NSLineBreakByTruncatingTail, ...Head and ...Middle all fell through to clipping: the glyphs that did not fit were hidden and no ellipsis was drawn, and head and middle kept the wrong glyphs. Add a truncation indicator to the layout. A line fragment can now carry a truncation glyph (an ellipsis) with a position and font, set by the typesetter through -setTruncationGlyph:atPoint:font:forGlyphRange: and read back with -truncationGlyphForGlyphAtIndex:. The glyph is transient layout information on the line fragment, so it is not written into the glyph store and a re-layout regenerates it correctly. NSLayoutManager draws it after the fragment's glyphs. GSHorizontalTypesetter now handles the three modes: tail drops trailing glyphs and places the ellipsis at the end, head shows a trailing suffix after a leading ellipsis, and middle keeps a leading prefix and a trailing suffix with the ellipsis between them. The hidden glyphs are marked not-shown and the shown suffix is repositioned. Tests/gui/GSHorizontalTypesetter/truncation.m covers the glyph visibility and the ellipsis for each mode. Closes gnustep#414
START_SET creates an autorelease pool and END_SET releases it, so the pool these tests create around the set is redundant.
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.
NSLineBreakByTruncatingTail, ...Head and ...Middle all fell through to clipping: the glyphs that did not fit were hidden and no ellipsis was drawn, and head and middle kept the wrong glyphs.
This adds a real truncation indicator. A line fragment can now carry a truncation glyph (an ellipsis) with a position and font:
The ellipsis glyph comes from the font, and if the font has none the line is clipped as before.
Tests: Tests/gui/GSHorizontalTypesetter/truncation.m checks, for each mode, which glyphs are shown or hidden and that the ellipsis is set. Layout was verified against the full text-layout suites with no regressions, and drawing of all three modes was checked against the X11 backend under Xvfb.
Closes #414