cad-editor/Cargo.toml
Hakan Seven cd048165a9 feat(fonts): system TrueType support with shaping and fallback
Add a TrueType/OpenType render path alongside the LFF stroke engine so
users can pick fonts installed on their machine for text and MText.

- Discover system families via fontdb (sysfont) and list them in the
  text-style picker.
- Extract glyph outlines with ttf-parser, flattened into wire strokes
  normalized to the same 9-unit cap-height space as LFF glyphs.
- Shape runs with cosmic-text (ligatures, Arabic joining, kerning, bidi)
  plus automatic font fallback: a glyph missing from the chosen family
  is taken from another installed font.
- Unify both sources behind a single Face type; a shared run tokenizer
  drives the stroke (per-glyph) and shaped (TTF) renderers identically.
- Stroke fonts now fall back to a system TTF (cosmic-text picks it) for
  characters no LFF font covers, replacing the unicode/iso3098 chain.

Also trim the embedded LFF set from 47 to 26, keeping the AutoCAD-SHX
equivalents and dropping LibreCAD-only fonts now covered by TrueType.

LFF builtins keep priority over same-named system fonts so DXF text
renders identically across machines.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 11:18:17 +03:00

70 lines
3.3 KiB
TOML

[package]
name = "OpenCADStudio"
version = "0.5.7"
edition = "2021"
build = "build.rs"
[workspace]
members = ["crates/ocs_plugin_api"]
# Embed the application icon into the Windows .exe so Explorer, the taskbar,
# the Start-menu tile and file-association entries show it (issue #107).
[target.'cfg(windows)'.build-dependencies]
winresource = "0.1"
[dependencies]
# Stable, dependency-free add-on contract (manifest + ribbon/CadModule types).
# Plugin authors target this crate's semver, not OpenCADStudio internals.
ocs_plugin_api = { path = "crates/ocs_plugin_api" }
# vtkio (pulled in transitively via truck-meshalgo) depends on xz2 → lzma-sys,
# which by default links the system liblzma dynamically. On macOS that bakes a
# Homebrew dylib path (/opt/homebrew/.../liblzma.5.dylib) into the binary, so
# the .app crashes on launch on machines without that exact library (#56).
# Forcing the `static` feature builds liblzma from the bundled source, making
# the binary self-contained on every platform.
lzma-sys = { version = "0.1", features = ["static"] }
iced = { version = "0.14", features = ["image", "svg", "advanced", "canvas", "smol"] }
bytemuck = { version = "1.25", features = ["derive"] }
glam = { version = "0.33", features = ["bytemuck"] }
truck-modeling = "0.6"
truck-meshalgo = { version = "0.4", default-features = false, features = ["tessellation"] }
truck-polymesh = "0.6"
rfd = "0.17"
acadrust = "0.3.4"
open = "5"
printpdf = "0.9.1"
flate2 = "1"
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] }
rayon = "1"
ureq = { version = "3", default-features = false, features = ["rustls"] }
inventory = "0.3"
truck-shapeops = "0.4"
# Fast non-cryptographic hasher. Handle/u64 keys dominate the hot block,
# hatch, draw-depth and wire caches; the default SipHash is overkill there.
rustc-hash = "2"
# TrueType/OpenType support: fontdb enumerates the user's installed system
# fonts; ttf-parser extracts glyph outlines we flatten into CAD wire strokes.
# Both are already in the tree transitively via iced's cosmic-text, so pinning
# them here adds no new downloads.
fontdb = "0.23"
ttf-parser = "0.25"
# Full text-layout engine: shaping (ligatures, Arabic joining, kerning), bidi
# reordering, and — crucially — automatic font fallback (a glyph missing from
# the chosen family is shaped from another installed font). We use it only to
# obtain positioned (font, glyph-id) runs; outlines come from ttf-parser and
# render through our own wire pipeline.
cosmic-text = "0.15"
[target.'cfg(target_os = "windows")'.dependencies]
# Win32_System_Com — COM behind "Set as default app"
# (IApplicationAssociationRegistrationUI dialog).
# Win32_System_Registry — HKCU registration that lists the app under
# "Open with" for the portable .exe.
windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_WindowsAndMessaging", "Win32_System_Com", "Win32_System_Registry", "Win32_Foundation"] }
[patch.crates-io]
# Tracks HakanSeven12/acadrust main, which carries the hatch
# boundary-handle cap, raster-image/wipeout clip-vertex fix, 3DFACE
# Z-decode fix, and CANNOSCALE/CANNOSCALEVALUE header support on top of
# upstream. Revert to upstream once those PRs land.
acadrust = { git = "https://github.com/HakanSeven12/acadrust", branch = "main" }