Share UTF-8 sources across styled text layouts - #93
Merged
Merged
Conversation
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.
Summary
Utf8Runessource, compactStyledTextRunbyte ranges, and a separate style table.typesetandconvertArrangementproc signatures. Align fonts and colors with the spans Pixie keeps when a styled run consists only of filtered controls, in both owned and shared paths.Utf8RunesraiseValueErrorinstead of dereferencing nil.tools/bench_text_source_rss.nimto compare retained input memory for owned strings and shared runs.Memory example
With a 16 MiB source and 65,536 runs, three macOS RSS samples measured about 25,376 KiB of additional RSS for owned run strings versus 1,296 KiB for shared source runs. This measures retained input representation, not full typesetting peak memory. Pixie's current span API still materializes temporary strings during layout.
Verification
atlas-run tests(45/45 static test targets passed)nim r -d:figdrawTextBackend=harfbuzzy tests/tfontutils.nimatlas-run tests --compile-only examples/siwin_text.nimatlas-run tests tnimkitagainst this branch/Volumes/projects/nims/Nim/bin/nim build_dynlib(Nim 2.3.1; native ABI and library staged)NIMFLAGS=-d:useNativeDynlib atlas-run tests dynlib_api dynlib_renderfragments native_ui_scale siwin_redraw(4/4 passed, including the new borrowed-span ABI test)The default Nim 2.2.12 install lacks compiler source required by Binny, so the dynlib build used the local Nim 2.3.1 checkout.