mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-14 19:27:07 -04:00
Fonts: embed Shippori Mincho once, shared by documents and the UI
The UI theme included the 8.7 MB font a second time; it now uses designcraft_fonts::JAPANESE_FALLBACK (release binary 72 MB -> 63 MB). The ROADMAP note joins the Interface language entry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
3ef82f850c
commit
7d721c92eb
4 files changed
+9
-8
No files matched your search
+1
-3
@@ -97,7 +97,7 @@ DesignCraft aims at full Adobe InDesign parity — and to be better: faster, ope
|
||||
- Transparency flattener (`file.exportPdf {flatten: high|medium|low|ppi}`, Edit ▸ Transparency Flattener Presets): each object involving transparency becomes an opaque image of its area over what's beneath it, so everything else stays vector (spreads with transparent parent items are rasterised whole).
|
||||
- Video and sound (place .mp4/.mov/.webm/.mp3/.wav…, `media.options/get`, Media panel): media frames show a poster or placeholder on screen, in print and in PDF, and export as HTML5 `<video>`/`<audio>` in EPUB. Interactive PDF export (`file.exportPdf {media: true}`, File ▸ Export PDF (Interactive)) embeds each file and plays it in a Screen annotation through a rendition action (controls, loop, play on page load). No in-app playback.
|
||||
- Right-to-left text (World-Ready basics): right-to-left runs are shaped right to left, lines are reordered by the Unicode Bidirectional Algorithm (matched against the reference implementation), Paragraph Direction (`type.para {direction}`, Paragraph panel, IDML ParagraphDirection, EPUB `dir`). Digits (`digits`: Default, Arabic, Hindi, Farsi, Native by language; Character panel for right-to-left text; IDML DigitsType) draw 0–9 in another script. Kashidas (`kashidas` paragraph attribute, on by default): justified Arabic lines stretch at one join per word (after seen/sad when possible, never inside lam–alef) with a drawn tatweel before word spaces widen. Carets follow the drawing: the caret before a right-to-left glyph sits at its right edge, arrow keys move as drawn (by words in the line's direction), clicks find the nearest drawn caret position and selections highlight the selected glyphs. Binding: Right to Left (Document Setup, `layout.documentSetup {binding}`, IDML PageBinding) makes page 1 a left page and lays spreads out right to left.
|
||||
- Interface language (Edit ▸ Interface Language, `app.language`): German, French, Spanish and Japanese menu titles, common menu items and panel names (our own translations); dialogs and the rest of the UI stay English.
|
||||
- Interface language (Edit ▸ Interface Language, `app.language`): German, French, Spanish and Japanese menu titles, common menu items and panel names (our own translations); dialogs and the rest of the UI stay English. The Type menu's Story Direction, Horizontal/Vertical, Tate-Chu-Yoko, Ruby… and Kenten are translated too. Japanese glyphs (UI and documents) come from the bundled Shippori Mincho (OFL), so no OS fonts are needed, natively or on the web.
|
||||
- Page transitions (`page.transition/transitions`, Page Transitions panel): twelve transition types with speed and direction per spread, written into exported PDFs as `/Trans` entries through an incremental update.
|
||||
- PDF/X-4 export (`file.exportPdf {standard: "x4"}`): an output intent with our own Generic CMYK ICC profile (lut16 tables generated from the parametric press model), GTS_PDFXVersion in Info and XMP, and built-in PDF/X-4 checks reported as warnings. qpdf finds no errors in the result.
|
||||
- EPS place: placed at its (high-resolution) bounding box and shown, printed and exported through its TIFF preview, or a placeholder when it has none. PostScript itself isn't interpreted.
|
||||
@@ -211,5 +211,3 @@ same references), and from the app's JSON control channel. See [docs/agents.md](
|
||||
| M12 | Interactive & digital (EPUB, HTML, interactive PDF) | started (EPUB, PDF links/bookmarks) |
|
||||
| M13 | Automation (scripts, batch) | |
|
||||
| M14 | 1.0 polish & packaging | |
|
||||
|
||||
- Japanese UI/document fallback: bundled OFL Shippori Mincho supplies Japanese glyphs on native and web without OS fonts. Story Direction, Horizontal/Vertical, Tate-Chu-Yoko, Ruby and Kenten menu labels are translated in all four non-English interface languages. Vertical metrics and warichu remain open.
|
||||
@@ -14,6 +14,10 @@ use skrifa::{GlyphId, MetadataProvider};
|
||||
/// The family used when a requested family is unknown (the UI sans).
|
||||
pub const FALLBACK_FAMILY: &str = "Source Sans 3";
|
||||
|
||||
/// Shippori Mincho (OFL): Japanese glyphs for documents and the UI without OS fonts. One copy,
|
||||
/// shared with the UI's egui fonts (it is ~8.7 MB).
|
||||
pub static JAPANESE_FALLBACK: &[u8] = include_bytes!("../../../assets/fonts/ShipporiMincho-Regular.ttf");
|
||||
|
||||
/// The bundled fonts (OFL), as font file bytes.
|
||||
pub fn bundled() -> &'static [&'static [u8]] {
|
||||
BUNDLED
|
||||
@@ -33,7 +37,7 @@ static BUNDLED: &[&[u8]] = &[
|
||||
include_bytes!("../../../assets/fonts/Inter-Medium.ttf"),
|
||||
include_bytes!("../../../assets/fonts/Inter-SemiBold.ttf"),
|
||||
include_bytes!("../../../assets/fonts/JetBrainsMono-Regular.ttf"),
|
||||
include_bytes!("../../../assets/fonts/ShipporiMincho-Regular.ttf"),
|
||||
JAPANESE_FALLBACK,
|
||||
];
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
mod fontdb;
|
||||
|
||||
pub use fontdb::{FALLBACK_FAMILY, FaceRef, FontDb, FontFace, base_style, bundled};
|
||||
pub use fontdb::{FALLBACK_FAMILY, FaceRef, FontDb, FontFace, JAPANESE_FALLBACK, base_style, bundled};
|
||||
pub use harfrust::Feature;
|
||||
use harfrust::{Direction, ShapeOptions, Tag, UnicodeBuffer};
|
||||
pub use kurbo::BezPath;
|
||||
@@ -251,8 +251,7 @@ mod tests {
|
||||
#[test]
|
||||
fn japanese_fallback_is_bundled_and_has_vertical_forms() {
|
||||
// Inspect the bundled face directly so this test cannot pass through an OS fallback.
|
||||
let data = include_bytes!("../../../assets/fonts/ShipporiMincho-Regular.ttf");
|
||||
let font = skrifa::FontRef::new(data).unwrap();
|
||||
let font = skrifa::FontRef::new(JAPANESE_FALLBACK).unwrap();
|
||||
for ch in "日本語縦書き横書きルビ、。「」".chars() {
|
||||
assert_ne!(font.charmap().map(ch).unwrap_or_default(), skrifa::GlyphId::NOTDEF);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ pub fn install_fonts(ctx: &egui::Context) {
|
||||
add(&mut fonts, "ui", include_bytes!("../../../assets/fonts/SourceSans3-Regular.ttf"));
|
||||
add(&mut fonts, "ui-semibold", include_bytes!("../../../assets/fonts/SourceSans3-Semibold.ttf"));
|
||||
add(&mut fonts, "mono", include_bytes!("../../../assets/fonts/JetBrainsMono-Regular.ttf"));
|
||||
add(&mut fonts, "japanese", include_bytes!("../../../assets/fonts/ShipporiMincho-Regular.ttf"));
|
||||
add(&mut fonts, "japanese", designcraft_fonts::JAPANESE_FALLBACK);
|
||||
fonts.families.entry(FontFamily::Proportional).or_default().insert(0, "ui".into());
|
||||
fonts.families.entry(FontFamily::Monospace).or_default().insert(0, "mono".into());
|
||||
fonts.families.insert(FontFamily::Name("semibold".into()), vec!["ui-semibold".into(), "ui".into()]);
|
||||
|
||||
Reference in new issue
Block a user