Merge #623: Part of #579: vectorcraft-cli lists the fonts font services load too

# Conflicts:
#	ROADMAP.md
This commit is contained in:
bflatastic 2026-10-09 05:48:40 +07:00
commit f3b90fb93f
6 changed files with 25 additions and 5 deletions

3
Cargo.lock generated
View File

@ -4352,6 +4352,7 @@ dependencies = [
name = "vectorcraft-cli"
version = "0.7.0"
dependencies = [
"log",
"serde_json",
"vectorcraft-color",
"vectorcraft-doc",
@ -4362,6 +4363,8 @@ dependencies = [
"vectorcraft-render",
"vectorcraft-svg",
"vectorcraft-testkit",
"vectorcraft-text",
"windows",
]
[[package]]

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,14 @@ vectorcraft-geom = { workspace = true }
vectorcraft-svg = { workspace = true }
vectorcraft-mcp = { workspace = true }
vectorcraft-render = { workspace = true }
vectorcraft-text = { workspace = true }
serde_json = { workspace = true }
log = { workspace = true }
# DirectWrite's system font collection (the desktop app's src/system_fonts.rs, shared): fonts that
# font services such as Adobe Fonts load in place (#579). MIT OR Apache-2.0.
[target.'cfg(all(windows, not(target_vendor = "win7")))'.dependencies]
windows = { version = "0.62", features = ["Win32_Graphics_DirectWrite"] }
[dev-dependencies]
vectorcraft-testkit = { workspace = true }

View File

@ -9,7 +9,9 @@
//! vectorcraft-cli bench FILE [--size 2880x1800] [--iters 5]
//! vectorcraft-cli perf [--paths 50000]
//! ```
#![forbid(unsafe_code)]
// Denied, not forbidden: the DirectWrite font lister shared with the desktop app (Windows) allows
// it for its COM calls, and nothing else may.
#![deny(unsafe_code)]
use std::io::Write;
use std::process::ExitCode;
@ -35,6 +37,10 @@ macro_rules! out {
}
mod perf;
/// The desktop app's DirectWrite font lister, shared: exports and MCP find the same fonts.
#[cfg(all(windows, not(target_vendor = "win7")))]
#[path = "../../vectorcraft/src/system_fonts.rs"]
mod system_fonts;
use serde_json::{Value, json};
use vectorcraft_mcp::{Backend, DEFAULT_ADDR, Headless, Remote, Server};
@ -93,6 +99,9 @@ fn usage() -> String {
}
fn main() -> ExitCode {
// Before any font lookup: the fonts font services load (#579).
#[cfg(all(windows, not(target_vendor = "win7")))]
system_fonts::install();
let args: Vec<String> = std::env::args().skip(1).collect();
let r = match args.first().map(String::as_str) {
Some("mcp") => mcp(&args[1..]),

View File

@ -1,5 +1,6 @@
//! Windows: the font files in DirectWrite's system font collection, scanned with the font folders
//! (`vectorcraft_text::set_platform_font_files`).
//! (`vectorcraft_text::set_platform_font_files`). The desktop app and `vectorcraft-cli` (exports,
//! MCP) both install it; the CLI shares this file.
//!
//! Font services such as Adobe Fonts load their fonts with GDI at run time, from files in their
//! own folders, without installing them: the font folders and the registry don't list them. Since

View File

@ -2382,8 +2382,8 @@ tone (mono, or CMYK screens multiplied over each other), clipped to the art's ou
Type can use the bundled fonts, fonts added to the session and the fonts installed on the system (none on the web):
the system's and the user's font folders (Windows: `Fonts` and `%LOCALAPPDATA%\Microsoft\Windows\Fonts`, plus fonts
registered outside them, such as fonts installed as shortcuts, and in the desktop app the fonts in DirectWrite's system
font collection, such as those Adobe Fonts activates while Creative Cloud runs; macOS: `/System/Library/Fonts`, `/Library/Fonts`,
registered outside them, such as fonts installed as shortcuts, and in the desktop app and `vectorcraft-cli` (MCP
included) the fonts in DirectWrite's system font collection, such as those Adobe Fonts activates while Creative Cloud runs; macOS: `/System/Library/Fonts`, `/Library/Fonts`,
`/Network/Library/Fonts`, `~/Library/Fonts` and downloaded system fonts; Linux and BSD: `/usr/share/fonts`,
`/usr/local/share/fonts`, `~/.fonts` and the XDG data folders' `fonts`, `~/.local/share/fonts` among them, and in a
Flatpak sandbox the host's fonts). The installed fonts are cataloged once per session (in the background when the app starts, else on the first lookup