Repository navigation
Releases: CHANG-JUI-LIN/YueduCoreText
Release list
0.9.0 — Bottom-justified pages
Pages can now end flush with the content bottom. With BrowserLayoutConfig.bottomJustify, a horizontal page that ends because its next text line no longer fits spreads the space left below its last line evenly over its line gaps: line k moves down by k × leftover ÷ (lines − 1), so the first line keeps its place and the last line's ink sits on the content bottom (legado's textBottomJustify).
- The page's fragments carry the moved geometry, so painting, hit testing, selection, links and highlights follow without change. Decoration boxes stretch with the lines they hold.
- A page keeps its lines when it ends at a forced break, an image, a float or a box start; when it is the document's last page; when the line that moved on is more than twice the last line's box (a display-size heading); when its last line is a block image; and when a box opens below its last line.
- Horizontal pages only. Vertical writing and continuous scrolling are never justified.
- Off by default; with it off, pages lay out exactly as in 0.8.0. It is not a cascade input, so an evaluation accepts a configuration that adds it.
Validation: the full package suite passes on iOS Simulator (183 tests), including session-versus-batch parity for justified pages. In Yuedu Reader, EPUB pages through the BrowserAuto engine end on the content bottom with the setting on.
0.7.0 — CJK typography in both writing modes
CJK text is now set as W3C's writing-mode and layout requirements describe, in horizontal and vertical text alike. A host passes the style it decided for a chapter in BrowserLayoutConfig.cjkTypographyStyle, and inline layout draws CJK text in its language's font, places and squeezes punctuation as CLREQ and JLREQ do, and orients vertical text by UAX #50. The same passes are public in YueduCoreTextTypography, so a host's own text engine can set CJK text by the same rules.
- Vertical text follows CSS Writing Modes 3
text-orientation: mixed: Latin letters and digits lie on their side, centred on the column; kana and Han stand; brackets and ー take their vertical alternates.VerticalOrientationcarries UAX #50 from the Unicode Character Database 18.0.0. CJKTypographyStyle(Traditional, Simplified, Japanese, Korean) andChineseScripttell a text's typography from its characters. Converters label Traditional textzh-cn, so the text decides, not the declared language.CJKTypography.applyFonts: CJK text in its language's font — PingFang TC or SC, Hiragino Sans, Apple SD Gothic Neo. On iOS the system font's fallback follows the device's languages, not the text's.CJKTypography.applyPositions: 、。,.:;?! where the style puts them — centred for Taiwan and Hong Kong, after the text for the Mainland, JLREQ's places for Japanese — corrected by measurement in fonts that put them elsewhere.CJKTypography.applySpacing: a pair of adjacent marks involving a bracket takes 1.5 em instead of 2 (CLREQ), the bracket kept against its text; :;?! keep their squares in vertical text; Japanese squeezes only between the marks (JLREQ §3.1.4).- Authored
text-combine-upright(縦中横) —all,digits 2–4and the prefixed spellings — becomes one upright cell.TextCombineUprightandCombinedUprightare public for a host's own engine. GlyphBoundarygives character boundaries as the glyphs stand after a negative kern; selection, highlights and hit testing use it.- Text without a family that resolves is set in the system font, not PingFang SC, and
ReaderFontCascadeno longer names PingFang SC or STHeiti SC. CJKTypographyProcessorkeeps quote conversion and its line-breaking classes; its punctuation compression is gone.ReaderPerfStage.cjkTypographyPreparemarks the pass in Points of Interest.
Measured in Yuedu Reader on the iOS 27 simulator (Debug): the pass costs 3–7 ms for a chapter of 5,000–10,800 characters in the reader's legacy engine, and 24–48 ms over the paragraphs of a ruby-heavy Japanese vertical chapter in BrowserAuto. Opening Chinese chapters stays within run-to-run noise. Text with no CJK returns from the font pass early.
Validation: the full package suite passes on iOS Simulator (49 typography and 165 engine tests). Yuedu Reader's acceptance tests draw marks through both of its engines and measure them from their ink; its render-fidelity scores, line-break baseline and loading benchmarks are recorded in the Reader repository.
0.6.2 — One parse per chapter
A chapter's markup and stylesheets are now parsed and styled once, and that one evaluation serves both the capability decision and the layout that follows. Hosts that decide the engine, prepare fonts and then lay out no longer parse each chapter two or three times.
- Adds
BrowserChapterDocument(input:)(one parse) andevaluate(configuration:), which returns aBrowserChapterEvaluationcarrying the verdict (capabilities, with font requests) and the style tree.bodyInlineStyleserves a host's font-scale policy from the same parse. - Adds
HTMLLayoutDocument(evaluation:)andBrowserLayoutSession(evaluation:), which lay out from that style tree instead of running the frontend again. - A layout may add geometry, a font resolver captured after font preparation, or a diagnostic sink to the evaluation's configuration (
rebound(to:)), but never different cascade inputs:accepts(_:)refuses and the initializers throw rather than lay out stale computed values. - Admission reads matched declarations from the cascade's own rule matching, plus the elements the cascade never styles, so verdicts, their order, text-indent usage and font requests are unchanged. The existing scanner,
HTMLLayoutDocument(input:configuration:)andBrowserLayoutSession(input:config:)entry points remain. - Retains iOS 17, Swift tools 6.0 and SwiftSoup 2.13.7 requirements.
Measured on five real EPUB chapters (Release, simulator, 7-round medians): CPU spent before the box tree drops from 48–467 ms to 24–237 ms (−43…−49%); a rejected chapter pays the same as before.
Validation: an equivalence suite compares verdicts against a copy of the previous scanner on real chapters and on markup built to probe hidden subtrees, head-only rules, dark media, first-letter and important declarations, and compares display lists from a reused style tree against a fresh parse. The full package suite passes on iOS Simulator (CI: Xcode 16.4). Reader layout, line-break baseline and loading benchmarks are recorded in the Reader repository.
0.6.1 — Computed-style font demand
Capability scanning now reports the font face tuples used by the existing computed-style tree. Hosts can prepare only those faces after accepting a chapter, then capture the font resolver before layout. This removes the need for publication-wide font preparation before an Auto admission decision.
- Adds
BrowserFontRequestandBrowserLayoutCapabilityResult.fontRequests, including inherited struts, visible descendants, ruby, materialized first-letter styles and glyph fallback families. - Adds a configuration-aware scan for reader font and bold settings; the original scanner signatures remain available.
- Keeps font registration, EPUB resources and fallback routing in the host. The scanner performs no resource I/O.
- Retains iOS 17, Swift tools 6.0 and SwiftSoup 2.13.7 requirements.
Validation: public API compatibility and font-demand tests pass on iOS Simulator. Release metadata, translated installation guides and public consumer snippets are checked by the release regression. Reader font, layout, fallback and writing-mode integration regressions are recorded in the Reader repository.
YueduCoreText 0.6.0
Added
- Demand-driven continuous layout through
BrowserViewportSession, with retained geometry, bounded drawing resources, source-position lookup and immutable published snapshots. BrowserViewportLayoutOwnerfor serialized background layout and resource retirement, plus transaction diagnostics.- Stable
BrowserPaintFragmentidentities, separate text paint phases and independently owned Core Text lines for background drawing. BrowserPageBackgroundmetadata so continuous hosts can draw authored canvas backgrounds at viewport size, including fixed attachment.
Fixed
- Reuse final resolved fonts, measured line geometry and unchanged display items during viewport layout.
- Use one half-leading calculation for paragraph struts and text runs, removing floating-point differences between equivalent line boxes.
- Preserve reader line-height decorations, source indices and drawing bounds while retaining or retiring viewport resources.
Migration
- Existing paged and prepared continuous APIs remain available. See viewport integration before adopting the new continuous API.
- Viewport geometry can contain estimated offscreen extents. Hosts must preserve the canonical UTF-16 source anchor when committing updated geometry.
- Draw
facts.pageBackgroundbehind the chapter; viewport display lists omit the propagated canvas background. Keep layout, hit-testing and drawing ownership separate as described in the migration guide. - iOS 17, Swift tools 6.0 and SwiftSoup 2.13.7 requirements are unchanged.
Validation
- Standalone package regressions, including the updated trace-stage API contract.
- Eight public API consumer tests, including viewport snapshot/resource retirement.
- Release build for generic iOS devices with code signing disabled.
YueduCoreText 0.5.0
YueduCoreText 0.5.0 fixes common English publishing CSS in the native HTML/CSS layout and rendering pipeline.
- Restores authored first-letter styling, including floated initials and opening punctuation.
- Corrects root inheritance, stylesheet order, signed/pt indentation, horizontal line-height and absolute min-height.
- Connects content language and
hyphensto line breaking and visible hyphen drawing without changing UTF-16 source text. - Adds sibling selectors, first-of-type, ordered-input capability scanning and local diagnostics.
- Preserves the existing horizontal/vertical ruby, pagination, continuous layout and public utility products.
Migration: exhaustive switches over CSSSelector.Combinator must handle adjacentSibling and generalSibling. Use .upToNextMinor(from: "0.5.0"). Corrected typography can change page geometry; retain source-based reading positions.
Requirements remain iOS 17, Swift tools 6.0 and SwiftSoup 2.13.7. This is a supported CSS subset, not full EPUB/CSS conformance.
Local iOS Simulator validation: 151 package/typography tests, 7 independent public API consumer tests, and 60 Reader integration/regression tests passed. The Reader cases include both supplied English EPUBs through paged and continuous Browser routes. No private books or fonts are included in this release.
See the three-language README and English typography and migration notes.
YueduCoreText 0.4.0
YueduCoreText 0.4.0
Adds basic native vertical-rl text layout and one ruby model for horizontal and vertical text, using the existing logical-coordinate layout pipeline.
- Incremental pagination and continuous vertical documents, with right-to-left column flow.
- Public
BrowserScrollDocument.documentPoint(forCharOffset:)for source-position restoration in either writing mode. - Physical page/document geometry, selection and hit testing; native Core Text vertical glyph forms.
- Compiled public-API vertical consumer and regressions for ruby, bitmap output, reflow, geometry and cancellation.
- Updated English, Traditional Chinese and Simplified Chinese integration guides.
This is basic normal-flow vertical text support. Unsupported vertical images, floats and advanced writing-mode features remain explicit diagnostics. Reader fallback policy remains in the host App. Minimum iOS 17 / Swift tools 6.0 and SwiftSoup 2.13.7 are unchanged.
繁體中文
新增基礎 vertical-rl 原生直排、橫直排共用 ruby,以及直排捲動所需的文字位置與幾何 API。Reader 必須將套件最低版本更新至 0.4.0,才能使用 documentPoint(forCharOffset:)。完整支援範圍與座標契約請見 直排文件。
简体中文
新增基础 vertical-rl 原生竖排、横竖排共用 ruby,以及竖排滚动所需的文字位置与几何 API。Reader 必须将包的最低版本更新至 0.4.0,才能使用 documentPoint(forCharOffset:)。完整支持范围与坐标契约请见 竖排文档。
Validation
- Local iOS Simulator 27 / Xcode 27 beta: 134 package tests and 6 independent public-API consumer tests passed.
- GitHub Actions (Xcode 16.4): release commit CI.
- No claim of real-device performance improvement or full EPUB/CSS compliance.
YueduCoreText 0.3.0
YueduCoreText 0.3.0 adds a standalone native HTML/CSS layout and rendering engine. Consumers can parse HTML/XHTML and ordered stylesheets, lay out blocks and inline content, paginate incrementally or create continuous documents, draw to CGContext, and query UTF-16 text/link/selection geometry without Yuedu Reader sources.
- Preserves the existing BrowserLayout float/ruby subset, images, backgrounds, borders, inline decoration and semantic descriptors.
- Retains the YueduCoreTextTypography product and existing selection, content-metrics and tracing APIs.
- Declares SwiftSoup 2.13.7; minimum requirements remain iOS 17 and Swift tools 6.0.
- Includes a compiled public-only iOS consumer example.
Validation uses iOS Simulator 27 with Xcode 27 beta: 128 package regressions, 5 independent consumer tests, and Reader integration checks. Exact geometry fingerprints and representative Browser PNGs match the extraction baseline. GitHub CI on Xcode 16.4 compiles the package but fails the existing Typography assertion punctuationStillCompressesWhenSafe (kern == -20, expected > -20). The same assertion failed in the 0.2.1 baseline CI; this release does not claim a green Xcode 16.4 test run. No real-device performance claim is made.
This release does not provide full CSS/EPUB compatibility, vertical HTML layout, table/flex/grid layout, EPUB container management, Reader UI, storage, or playback. Read README.md and docs/EngineIntegration.md for supported scope, explicit resource loading, coordinates, cancellation and executor ownership.
CI evidence: 0.3.0, 0.2.1 baseline.
YueduCoreText 0.2.1
Fixes CJK punctuation compression by measuring the actual Core Text shaped glyph ink gap before applying negative kerning. This prevents adjacent punctuation such as ellipsis followed by a closing bracket from overlapping across system, EPUB, and fallback fonts.
YueduCoreText 0.2.0
YueduCoreText 0.2.0 adds the first standalone reader-core APIs alongside the existing typography product.
Highlights:
- ReaderContentMetrics and ReaderContentUnitMap for stable book-wide progress.
- TextSelectionManager and stable TextSelectionEndpoint tokens.
- ReaderPerfTrace with privacy-bounded Points of Interest metadata.
- Public API, dependency-boundary, DocC, and release metadata tests.
- Xcode 16 and iOS 17 support.
The package exposes YueduCoreText and YueduCoreTextTypography as separate library products.