UI 한글 글꼴 공급을 플랫폼별로 분리
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
8600cee802bc08bfad171278133a22d94b64b597- 부모
- f7fc8cb
변경된 파일 5개
+263-4| @@ -1,3 +1,6 @@ | ||
| 1 | 추가: #[path = "system_font.rs"] | |
| 2 | 추가: mod system_font; | |
| 3 | 추가: | |
| 1 | 4 | use eframe::egui::{self, Color32, FontData, FontDefinitions, FontFamily, FontId, TextStyle}; |
| 2 | 5 | use zipelo_ui_memory_app::{ |
| 3 | 6 | controller::{CloseState, Controller}, |
| @@ -155,8 +158,7 @@ impl eframe::App for App { | ||
| 155 | 158 | } |
| 156 | 159 | |
| 157 | 160 | fn 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)))?; | |
| 160 | 162 | eframe::run_native( |
| 161 | 163 | "Zipelo 합성 메모리 작업", |
| 162 | 164 | eframe::NativeOptions { |
| @@ -168,8 +170,8 @@ fn main() -> eframe::Result { | ||
| 168 | 170 | }, |
| 169 | 171 | Box::new(move |cc| { |
| 170 | 172 | 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; | |
| 173 | 175 | fonts.font_data.insert("noto-kr".into(), data.into()); |
| 174 | 176 | fonts |
| 175 | 177 | .families |
| @@ -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 | 추가: } |
| @@ -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 |
| @@ -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 | 추가: } |
| @@ -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 | 추가: } |