team-ljyzipelo

공개

UI 한글 글꼴 공급을 플랫폼별로 분리

작성자
호시노 히나타
작성 시각
커밋
8600cee802bc08bfad171278133a22d94b64b597
부모
f7fc8cb
이 시점의 파일 보기

변경된 파일 5개

+263-4
수정experiments/rust-ui-memory-app/src/app.rs+6-4
@@ -1,3 +1,6 @@
1추가: #[path = "system_font.rs"]
2추가: mod system_font;
3추가:
14use eframe::egui::{self, Color32, FontData, FontDefinitions, FontFamily, FontId, TextStyle};
25use zipelo_ui_memory_app::{
36 controller::{CloseState, Controller},
@@ -155,8 +158,7 @@ impl eframe::App for App {
155158}
156159
157160fn main() -> eframe::Result {
158삭제: let font = std::fs::read("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc")
159삭제: .map_err(|e| eframe::Error::AppCreation(Box::new(e)))?;
161추가: let font = system_font::load().map_err(|e| eframe::Error::AppCreation(Box::new(e)))?;
160162 eframe::run_native(
161163 "Zipelo 합성 메모리 작업",
162164 eframe::NativeOptions {
@@ -168,8 +170,8 @@ fn main() -> eframe::Result {
168170 },
169171 Box::new(move |cc| {
170172 let mut fonts = FontDefinitions::empty();
171삭제: let mut data = FontData::from_owned(font);
172삭제: data.index = 1;
173추가: let mut data = FontData::from_owned(font.bytes);
174추가: data.index = font.face_index;
173175 fonts.font_data.insert("noto-kr".into(), data.into());
174176 fonts
175177 .families
추가experiments/rust-ui-memory-app/src/system_font.rs+65-0
@@ -0,0 +1,65 @@
1추가: use std::io;
2추가:
3추가: pub(super) struct RuntimeFont {
4추가: pub bytes: Vec<u8>,
5추가: pub face_index: u32,
6추가: }
7추가:
8추가: pub(super) fn load() -> io::Result<RuntimeFont> {
9추가: platform::load()
10추가: }
11추가:
12추가: #[cfg(target_os = "linux")]
13추가: mod platform {
14추가: use super::RuntimeFont;
15추가: use std::io;
16추가:
17추가: pub(super) fn load() -> io::Result<RuntimeFont> {
18추가: Ok(RuntimeFont {
19추가: bytes: std::fs::read("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc")?,
20추가: face_index: 1,
21추가: })
22추가: }
23추가: }
24추가:
25추가: #[cfg(target_os = "windows")]
26추가: mod platform {
27추가: use super::RuntimeFont;
28추가: use std::{io, path::PathBuf};
29추가:
30추가: pub(super) fn load() -> io::Result<RuntimeFont> {
31추가: let root = std::env::var_os("SystemRoot").ok_or_else(|| {
32추가: io::Error::new(
33추가: io::ErrorKind::NotFound,
34추가: "Windows system directory is unavailable",
35추가: )
36추가: })?;
37추가: let root = PathBuf::from(root);
38추가: if !root.is_absolute()
39추가: || !matches!(root.components().next(), Some(std::path::Component::Prefix(prefix))
40추가: if matches!(prefix.kind(), std::path::Prefix::Disk(_)))
41추가: {
42추가: return Err(io::Error::new(
43추가: io::ErrorKind::InvalidInput,
44추가: "Windows system directory must be a local absolute drive path",
45추가: ));
46추가: }
47추가: Ok(RuntimeFont {
48추가: bytes: std::fs::read(root.join("Fonts").join("malgun.ttf"))?,
49추가: face_index: 0,
50추가: })
51추가: }
52추가: }
53추가:
54추가: #[cfg(not(any(target_os = "linux", target_os = "windows")))]
55추가: mod platform {
56추가: use super::RuntimeFont;
57추가: use std::io;
58추가:
59추가: pub(super) fn load() -> io::Result<RuntimeFont> {
60추가: Err(io::Error::new(
61추가: io::ErrorKind::Unsupported,
62추가: "No Korean system font provider is available for this platform",
63추가: ))
64추가: }
65추가: }
추가tests/rust-ui-system-fonts/SHA256SUMS+4-0
@@ -0,0 +1,4 @@
1추가: 5bef670594b8edf6d9b979871da56447342c92126fd56c6acd9eb7e3a9cece95 experiments/rust-ui-memory-app/src/app.rs
2추가: f15657021dcb48bf3d0bb570dbcea1e36c4f7c9694cde21be972e350580851f7 experiments/rust-ui-memory-app/src/system_font.rs
3추가: c3fab0200d3ce39f8cf2411eab698811b12037d45aeb22984a9be7f6be4d3902 tests/rust-ui-system-fonts/contract.json
4추가: 5d62336ecbbf963b9957849e27785a3d7a8f9342951244097cbd1db70b1450ca tests/rust-ui-system-fonts/sources.json
추가tests/rust-ui-system-fonts/contract.json+63-0
@@ -0,0 +1,63 @@
1추가: {
2추가: "schema": 1,
3추가: "branch": "features/rust-ui-system-fonts",
4추가: "base": "f7fc8cbece281e2f9a6374b4640ca4dd9d321fbc",
5추가: "scope": "UI 진입점의 폰트 공급만 분리함. 화면 구조/색/크기/Controller/파일-job 변경 없음",
6추가: "api": {
7추가: "module": "experiments/rust-ui-memory-app/src/system_font.rs",
8추가: "visibility": "binary 내부 pub(super) 경계임. library public API 추가 없음",
9추가: "load": "fn load() -> std::io::Result<RuntimeFont>",
10추가: "value": "RuntimeFont { bytes: Vec<u8>, face_index: u32 }",
11추가: "ownership": "설치된 글꼴을 실행 시 메모리로 읽어 기존 FontData::from_owned로 이동함. 파일 쓰기/번들/다운로드 없음"
12추가: },
13추가: "platforms": {
14추가: "linux": {
15추가: "file": "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
16추가: "face_index": 1,
17추가: "preserved": "기존 std::fs::read I/O 오류를 원형으로 ? 반환하고 AppCreation(Box<io::Error>)로 매핑함. 기본 글꼴로 조용히 대체하지 않음"
18추가: },
19추가: "windows": {
20추가: "file": "SystemRoot 환경값 아래 Fonts/malgun.ttf",
21추가: "face_index": 0,
22추가: "root": "std::env::var_os로 Unicode 손실 없이 읽음. 미설정 NotFound, 상대/UNC/장치 prefix는 InvalidInput으로 실패함. local absolute Disk prefix만 허용함",
23추가: "read": "파일 읽기 I/O 오류는 원형으로 반환함. missing file 설치/자동 탐색/다른 글꼴 대체 없음",
24추가: "limit": "환경값은 OS API로 인증한 Windows directory가 아님. 정상 프로세스 환경을 전제로 한 최소 공급 경계이며 시스템 폰트의 진위/글리프/포맷 유효성을 별도로 입증하지 않음",
25추가: "reference": "https://learn.microsoft.com/en-us/typography/font-list/malgun-gothic"
26추가: },
27추가: "other": "io::ErrorKind::Unsupported로 명시 실패함"
28추가: },
29추가: "dependencies": {
30추가: "new_external": 0,
31추가: "cargo_changes": 0,
32추가: "font_distribution": false
33추가: },
34추가: "validation": {
35추가: "state": "source/static only. build/run/metadata/GUI/Windows compile 없음",
36추가: "performed": [
37추가: "rustfmt +1.99.1 --edition 2024 --check",
38추가: "base app Git blob 대조",
39추가: "변경 파일 SHA256와 원격 tree 제한 변경 대조"
40추가: ],
41추가: "linux_plan": [
42추가: "고정 overlay manifest와 base blob/mode, dependency/lock 불변 확인",
43추가: "기존 toolchain locked/offline GUI build 및 headless 31개 회귀 이름 대조/각1회",
44추가: "Linux 공급 bytes가 기존 Noto bytes와 같고 index=1임을 확인. missing/unreadable I/O 오류를 합성 소유 환경의 loader 시험에서 확인",
45추가: "분리 Xvfb의 실제 앱으로 초기 한글/18px 본문/26px 제목/목록/미리보기/오류 상태 및 idle 종료 확인",
46추가: "PR47 harness는 자체 Linux 폰트 로더를 보존한 별도 시험임. 해당 결과를 새 앱 로더의 검증으로 합산하지 않음"
47추가: ],
48추가: "windows_plan": [
49추가: "기존 Windows 도구체인 확보와 별도 실행 승인 후 locked/offline native build",
50추가: "정상 SystemRoot 및 설치 Malgun 글꼴에서 index0/한글/읽기 전용/정상 닫기 확인",
51추가: "SystemRoot 없음/상대경로/UNC/장치 경로는 각각 NotFound/InvalidInput 판정 확인. Fonts/malgun.ttf 없음/읽기 오류 원형 보존 확인",
52추가: "한글 목록/미리보기/취소/닫기 및 키보드/크기 변경을 실제 Windows 화면에서 검증. 이 전에는 지원 완료로 표시하지 않음"
53추가: ],
54추가: "failure": "첫 실패에서 중단하고 source/expectation 변경이나 자동 재실행 없음. 명령/exit/raw로그/hash/입력 전후/소유 process 정리 기록",
55추가: "historical_pins": "기존 tests/rust-ui-memory-app/SHA256SUMS 및 각 frozen source pin은 기존 head 증거로 보존함. app.rs 변경 때문에 원래 전체 고정 hash 검사를 새 head에 통과했다고 말하지 않음. 새 sources.json overlay가 이 후보의 변경을 명시함",
56추가: "limits": [
57추가: "Windows 도구체인 없음",
58추가: "폰트 parse/글리프 검증 미실행",
59추가: "사용자 display/IME/전체 접근성 미검증",
60추가: "기존 빌드/GUI 결과를 이 변경 head로 승격하지 않음"
61추가: ]
62추가: }
63추가: }
추가tests/rust-ui-system-fonts/sources.json+125-0
@@ -0,0 +1,125 @@
1추가: {
2추가: "base_head": "f7fc8cbece281e2f9a6374b4640ca4dd9d321fbc",
3추가: "base_tree": "ab5574289f537a4028a3abf092e4634cb9b89282",
4추가: "base_app_blob": "715ba9d662e507ad8a11b232edcefcf86276a14a",
5추가: "changed_existing_paths": [
6추가: "experiments/rust-ui-memory-app/src/app.rs"
7추가: ],
8추가: "new_source_paths": [
9추가: "experiments/rust-ui-memory-app/src/system_font.rs"
10추가: ],
11추가: "ui_overlay": [
12추가: {
13추가: "path": "experiments/rust-ui-memory-app/Cargo.lock",
14추가: "sha256": "d591ec67b8f1a1ea448b6bdd971e0b8c039a33a492c8f068b085bdd20b3a64ae",
15추가: "base_sha256": "d591ec67b8f1a1ea448b6bdd971e0b8c039a33a492c8f068b085bdd20b3a64ae"
16추가: },
17추가: {
18추가: "path": "experiments/rust-ui-memory-app/Cargo.toml",
19추가: "sha256": "7a74a5d5be456dc6d080c0dd78a25eaf8bd12ef43a3b921f26bbb7e35901040f",
20추가: "base_sha256": "7a74a5d5be456dc6d080c0dd78a25eaf8bd12ef43a3b921f26bbb7e35901040f"
21추가: },
22추가: {
23추가: "path": "experiments/rust-ui-memory-app/LICENSE",
24추가: "sha256": "0714945e52a4d5b560c02c9a18478519f8c4e2572cbf87bd6d52adcfb2b63c62",
25추가: "base_sha256": "0714945e52a4d5b560c02c9a18478519f8c4e2572cbf87bd6d52adcfb2b63c62"
26추가: },
27추가: {
28추가: "path": "experiments/rust-ui-memory-app/THIRD-PARTY-NOTICES.txt",
29추가: "sha256": "5b98107ae51806d6d4cb4337bea3b979f55070eba6dc7c0c294e13e7686ab4c6",
30추가: "base_sha256": "5b98107ae51806d6d4cb4337bea3b979f55070eba6dc7c0c294e13e7686ab4c6"
31추가: },
32추가: {
33추가: "path": "experiments/rust-ui-memory-app/src/app.rs",
34추가: "sha256": "5bef670594b8edf6d9b979871da56447342c92126fd56c6acd9eb7e3a9cece95",
35추가: "base_sha256": "1cddb84c6a8c5e4188be79220c92532351e51979d7ad0edbc0a12ac5381ed72c"
36추가: },
37추가: {
38추가: "path": "experiments/rust-ui-memory-app/src/controller.rs",
39추가: "sha256": "51dc979b88e395c209444900511aa7d56bcc8ccc31205fca22191f25dc6468e2",
40추가: "base_sha256": "51dc979b88e395c209444900511aa7d56bcc8ccc31205fca22191f25dc6468e2"
41추가: },
42추가: {
43추가: "path": "experiments/rust-ui-memory-app/src/lib.rs",
44추가: "sha256": "58d303d44c6b8580168f14c3ceb0eb878fc7a003f197f162584286873a904ddc",
45추가: "base_sha256": "58d303d44c6b8580168f14c3ceb0eb878fc7a003f197f162584286873a904ddc"
46추가: },
47추가: {
48추가: "path": "experiments/rust-ui-memory-app/src/runtime.rs",
49추가: "sha256": "c1c1dde16263ea7ed4cf5808b3182e21878b8ffadfe8850974a8cbdbd4607b3f",
50추가: "base_sha256": "c1c1dde16263ea7ed4cf5808b3182e21878b8ffadfe8850974a8cbdbd4607b3f"
51추가: },
52추가: {
53추가: "path": "experiments/rust-ui-memory-app/src/transport.rs",
54추가: "sha256": "7aef227ed4424e13cfa750373a9e1f32bebae12308589c81d051f41ea84991ac",
55추가: "base_sha256": "7aef227ed4424e13cfa750373a9e1f32bebae12308589c81d051f41ea84991ac"
56추가: },
57추가: {
58추가: "path": "tests/rust-ui-memory-app/contract.json",
59추가: "sha256": "5a9a48f08dea0d3b103a359251bde06dd82e2568be02bdb905f5b0ceb7bb6dd9",
60추가: "base_sha256": "5a9a48f08dea0d3b103a359251bde06dd82e2568be02bdb905f5b0ceb7bb6dd9"
61추가: },
62추가: {
63추가: "path": "tests/rust-ui-memory-app/dependencies.json",
64추가: "sha256": "5ee41a973a0e976fbb6fe36d4a3fcb0ed026e638e997042a0bef8c2f238f0599",
65추가: "base_sha256": "5ee41a973a0e976fbb6fe36d4a3fcb0ed026e638e997042a0bef8c2f238f0599"
66추가: },
67추가: {
68추가: "path": "tests/rust-ui-memory-app/dependency_audit.py",
69추가: "sha256": "8536779d3551eb86a82f4c8b814bb26ddeaff04f992d3e080ae06321f10e3453",
70추가: "base_sha256": "8536779d3551eb86a82f4c8b814bb26ddeaff04f992d3e080ae06321f10e3453"
71추가: },
72추가: {
73추가: "path": "tests/rust-ui-memory-app/files.json",
74추가: "sha256": "97c0bc5c804d85fb523da4c76abff2bec3aed3ae1e02b68db1c19792e9843808",
75추가: "base_sha256": "97c0bc5c804d85fb523da4c76abff2bec3aed3ae1e02b68db1c19792e9843808"
76추가: },
77추가: {
78추가: "path": "tests/rust-ui-memory-app/fixtures/payload.txt",
79추가: "sha256": "ce7c1973b4eab97e4e49257ce4dbc5cb35c5a1eaae7c666a04b548fe1fd41dba",
80추가: "base_sha256": "ce7c1973b4eab97e4e49257ce4dbc5cb35c5a1eaae7c666a04b548fe1fd41dba"
81추가: },
82추가: {
83추가: "path": "tests/rust-ui-memory-app/fixtures/sample.gz",
84추가: "sha256": "6adcdc0775bca7b8c1ff8e41adeecf8a724f876f8b469f7f8fc611406a626e61",
85추가: "base_sha256": "6adcdc0775bca7b8c1ff8e41adeecf8a724f876f8b469f7f8fc611406a626e61"
86추가: },
87추가: {
88추가: "path": "tests/rust-ui-memory-app/fixtures/sample.tar",
89추가: "sha256": "910cb4573b57fd26f122376f3f4eae0e4397163b83e32a3c850758d42f88dc55",
90추가: "base_sha256": "910cb4573b57fd26f122376f3f4eae0e4397163b83e32a3c850758d42f88dc55"
91추가: },
92추가: {
93추가: "path": "tests/rust-ui-memory-app/license-supplement.json",
94추가: "sha256": "09aca74cb3f20f1ed5b3e03fd647c80ef8e872f6ff97e17882cf2fda8b108b2c",
95추가: "base_sha256": "09aca74cb3f20f1ed5b3e03fd647c80ef8e872f6ff97e17882cf2fda8b108b2c"
96추가: },
97추가: {
98추가: "path": "tests/rust-ui-memory-app/reference-ui.lock",
99추가: "sha256": "865d69b95660fefe8c9ad6129d2692cff8007ecc3d55de1a049fe162173f434d",
100추가: "base_sha256": "865d69b95660fefe8c9ad6129d2692cff8007ecc3d55de1a049fe162173f434d"
101추가: },
102추가: {
103추가: "path": "tests/rust-ui-memory-app/regressions.rs",
104추가: "sha256": "4eec2f9e036bc0fc04a1ff0af31aa28e593c185f8d1d230c8105a8fefc92fc4d",
105추가: "base_sha256": "4eec2f9e036bc0fc04a1ff0af31aa28e593c185f8d1d230c8105a8fefc92fc4d"
106추가: },
107추가: {
108추가: "path": "tests/rust-ui-memory-app/sources.json",
109추가: "sha256": "f6a7b3df44869c206ff517f32653885c5fcd2f335ef4e8eff94d6ab626ca4119",
110추가: "base_sha256": "f6a7b3df44869c206ff517f32653885c5fcd2f335ef4e8eff94d6ab626ca4119"
111추가: },
112추가: {
113추가: "path": "tests/rust-ui-memory-app/static_check.py",
114추가: "sha256": "6a756de6da66731b1ea9eaaacedfbe32096bd6a918eab591a392bc45529184f5",
115추가: "base_sha256": "6a756de6da66731b1ea9eaaacedfbe32096bd6a918eab591a392bc45529184f5"
116추가: },
117추가: {
118추가: "path": "experiments/rust-ui-memory-app/src/system_font.rs",
119추가: "sha256": "f15657021dcb48bf3d0bb570dbcea1e36c4f7c9694cde21be972e350580851f7",
120추가: "base_sha256": null
121추가: }
122추가: ],
123추가: "dependency_change": false,
124추가: "original_manifests": "기존 고정 manifest는 과거 head 증거로 보존함. 이 overlay는 변경 app과 신규 module만 다른 입력임을 명시함"
125추가: }