mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 04:07:12 -06:00
Merge pull request #1190 from storytold/fix/thai-font-filter
Font menu: a Thai script filter
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -574,10 +574,12 @@ impl FontClass {
|
||||
[FontClass::Serif, FontClass::Sans, FontClass::Rounded, FontClass::Script, FontClass::Monospaced, FontClass::Decorative];
|
||||
}
|
||||
|
||||
/// What a font menu filters on: whether a family sets Japanese, and its kind.
|
||||
/// What a font menu filters on: whether a family sets Japanese or Thai, and its kind.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub struct FontTraits {
|
||||
pub japanese: bool,
|
||||
/// Its character map has Thai (ก and า).
|
||||
pub thai: bool,
|
||||
pub class: FontClass,
|
||||
}
|
||||
|
||||
@@ -595,6 +597,7 @@ impl FontTraits {
|
||||
};
|
||||
// Hiragana (bit 49) or Katakana (bit 50) in the Unicode ranges, or the JIS code page.
|
||||
let japanese = ranges2 & (0b11 << 17) != 0 || codepages & (1 << 17) != 0 || has_japanese_name;
|
||||
let thai = ['\u{0E01}', '\u{0E32}'].iter().all(|c| font.charmap().map(*c).is_some());
|
||||
let family_type = panose.first().copied().unwrap_or(0);
|
||||
let serif_style = panose.get(1).copied().unwrap_or(0);
|
||||
let proportion = panose.get(3).copied().unwrap_or(0);
|
||||
@@ -692,7 +695,7 @@ impl FontTraits {
|
||||
} else {
|
||||
FontClass::Other
|
||||
};
|
||||
FontTraits { japanese, class }
|
||||
FontTraits { japanese, thai, class }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,17 +84,29 @@ const SAMPLES_PER_FRAME: usize = 4;
|
||||
const MAX_PENDING: usize = 8;
|
||||
/// What a sample shows when the font lacks the selected text's characters (or there is none).
|
||||
const FALLBACK_SAMPLE: &str = "Sample";
|
||||
/// The script filter's choices: all, Japanese, Latin.
|
||||
const SCRIPTS: usize = 3;
|
||||
/// The script filter's choices: all, Japanese, Latin, Thai.
|
||||
const SCRIPTS: usize = 4;
|
||||
|
||||
fn script_label(i: usize) -> &'static str {
|
||||
match i {
|
||||
1 => tl!("Japanese"),
|
||||
2 => tl!("Latin"),
|
||||
3 => tl!("Thai"),
|
||||
_ => tl!("All Scripts"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Does a family of `traits` pass script filter `script` ([`SCRIPTS`])? Latin: neither Japanese
|
||||
/// nor Thai.
|
||||
fn script_matches(script: usize, traits: vectorcraft_text::FontTraits) -> bool {
|
||||
match script {
|
||||
1 => traits.japanese,
|
||||
2 => !traits.japanese && !traits.thai,
|
||||
3 => traits.thai,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
fn class_label(c: FontClass) -> &'static str {
|
||||
match c {
|
||||
FontClass::Serif => tl!("Serif / Mincho"),
|
||||
@@ -283,7 +295,7 @@ fn list(ui: &mut Ui, state_id: egui::Id, st: &mut MenuState, current: &str, samp
|
||||
return true;
|
||||
}
|
||||
let traits = db.family_traits(f);
|
||||
(st.script == 0 || (st.script == 1) == traits.japanese) && st.class.is_none_or(|c| c == traits.class)
|
||||
script_matches(st.script, traits) && st.class.is_none_or(|c| c == traits.class)
|
||||
};
|
||||
let mut rows: Vec<Row> = vec![];
|
||||
for f in db.menu_family_list().iter().filter(|f| wanted(f)) {
|
||||
@@ -748,6 +760,21 @@ pub(crate) fn sample_text(app: &VectorcraftApp) -> Option<String> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
/// The script filter: Thai lists families with Thai; Latin, those with neither Thai nor
|
||||
/// Japanese.
|
||||
#[test]
|
||||
fn the_thai_filter_lists_fonts_with_thai() {
|
||||
use vectorcraft_text::FontTraits;
|
||||
let (thai, japanese, latin) =
|
||||
(FontTraits { thai: true, ..Default::default() }, FontTraits { japanese: true, ..Default::default() }, FontTraits::default());
|
||||
let passing = |t: FontTraits| (0..super::SCRIPTS).filter(|s| super::script_matches(*s, t)).collect::<Vec<_>>();
|
||||
assert_eq!(passing(thai), [0, 3]);
|
||||
assert_eq!(passing(japanese), [0, 1]);
|
||||
assert_eq!(passing(latin), [0, 2]);
|
||||
assert_eq!(super::script_label(3), "Thai");
|
||||
}
|
||||
|
||||
use super::{Row, remap_highlight};
|
||||
|
||||
fn family(name: &str) -> Row {
|
||||
|
||||
@@ -1323,6 +1323,7 @@
|
||||
Last Effect… Letzter Effekt…
|
||||
Last Page Letzte Seite
|
||||
Latin Lateinisch
|
||||
Thai Thai
|
||||
Latin Extended Lateinisch, erweitert
|
||||
Latin-1 Supplement Lateinisch-1, Ergänzung
|
||||
Layer Ebene
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1341,6 +1341,7 @@
|
||||
Last Effect… Último efecto…
|
||||
Last Page Última página
|
||||
Latin Latín
|
||||
Thai Tailandés
|
||||
Latin Extended Latín extendido
|
||||
Latin-1 Supplement Suplemento Latín-1
|
||||
Layer Capa
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1340,6 +1340,7 @@
|
||||
Last Effect… Dernier effet…
|
||||
Last Page Dernière page
|
||||
Latin Latin
|
||||
Thai Thaï
|
||||
Latin Extended Latin étendu
|
||||
Latin-1 Supplement Supplément Latin-1
|
||||
Layer Calque
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1341,6 +1341,7 @@
|
||||
Last Effect… Ultimo effetto…
|
||||
Last Page Ultima pagina
|
||||
Latin Latino
|
||||
Thai Thailandese
|
||||
Latin Extended Latino esteso
|
||||
Latin-1 Supplement Supplemento Latino-1
|
||||
Layer Livello
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -48,6 +48,7 @@
|
||||
Hard 強い禁則
|
||||
Soft 弱い禁則
|
||||
Latin 欧文
|
||||
Thai タイ文字
|
||||
Monospaced 等幅
|
||||
Roman Baseline 欧文ベースライン
|
||||
Rounded 丸ゴシック
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1339,6 +1339,7 @@
|
||||
Last Effect… Последний эффект…
|
||||
Last Page Последняя страница
|
||||
Latin Латиница
|
||||
Thai Тайская
|
||||
Latin Extended Расширенная латиница
|
||||
Latin-1 Supplement Дополнение Latin-1
|
||||
Layer Слой
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1335,6 +1335,7 @@
|
||||
Last Effect… Останній ефект…
|
||||
Last Page Остання сторінка
|
||||
Latin Латиниця
|
||||
Thai Тайська
|
||||
Latin Extended Розширена латиниця
|
||||
Latin-1 Supplement Додаток Latin-1
|
||||
Layer Шар
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 659 and column 40.
|
@@ -3417,6 +3417,7 @@
|
||||
Graphics: {adapter} 显卡:{adapter}
|
||||
Japanese 日文
|
||||
Latin 拉丁文
|
||||
Thai 泰文
|
||||
Layer Options 图层选项
|
||||
Layers Panel Options 图层面板选项
|
||||
Monospaced 等宽
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -1316,6 +1316,7 @@
|
||||
Last Effect… 最後一次效果…
|
||||
Last Page 最後一頁
|
||||
Latin 拉丁文
|
||||
Thai 泰文
|
||||
Latin Extended 拉丁文擴充
|
||||
Latin-1 Supplement 拉丁文-1 補充
|
||||
Layer 圖層
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
+3
-1
@@ -1,6 +1,6 @@
|
||||
# Type parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (Thai, Lao, Khmer and Myanmar lines break between words; the caret steps over whole clusters such as Thai consonants with their marks; Thai typed in a font without Thai falls back to a font made for Thai; earlier: Proportional Metrics in vertical type, `vpal`, #966) · **Target:** Adobe Illustrator 2026 (30.x)
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-11 · **Change:** minor (the font menu's script filter lists Thai fonts; Thai, Lao, Khmer and Myanmar lines break between words; the caret steps over whole clusters such as Thai consonants with their marks; Thai typed in a font without Thai falls back to a font made for Thai; earlier: Proportional Metrics in vertical type, `vpal`, #966) · **Target:** Adobe Illustrator 2026 (30.x)
|
||||
|
||||
Type is Illustrator's largest single area by use (weight 13 of 105 across "Type core" and "Type advanced" in
|
||||
[target-app-parity.md](target-app-parity.md)). This checklist lists the features one by one. Status is from the
|
||||
@@ -26,6 +26,7 @@ against Illustrator's public documentation; **estimated** unless noted.
|
||||
| Character size and horizontal scale after object/group scaling | done | #1034: fields and setters compensate the stored affine; point size follows the transformed em-height axis, not the glyph ink bounds. Range edits, keyboard increments, leading and baseline shift use document points; rotation, reflection and shear remain editable. |
|
||||
| Preserve font sizes while scaling a group | missing | Separate enhancement; scaling still scales text with the other artwork. |
|
||||
| OpenType panel, Glyphs panel, alternates | done | Highlight Alternate Glyphs preference unused (#394) |
|
||||
| Font menu: samples, live preview, filters, favourites; font matching by any name; Find Font | done | #339; script filter: Japanese, Latin, Thai |
|
||||
| Font menu: samples, live preview, filters, favourites; font matching by any name; Find Font | done | #339 |
|
||||
| Missing glyphs set in an installed font made for their script (Thai, Lao, Khmer, Myanmar first; then any font that has them) | done | Thai: Leelawadee UI, Tahoma, Thonburi, Sukhumvit Set, Noto Sans Thai, TLWG |
|
||||
| Variable fonts | partial | named instances as styles; axis sliders missing |
|
||||
@@ -54,6 +55,7 @@ against Illustrator's public documentation; **estimated** unless noted.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-11 | minor | Font menu: a Thai script filter beside Japanese and Latin; score unchanged (estimated) |
|
||||
| 2026-10-11 | minor | Thai, Lao, Khmer and Myanmar text breaks its lines between words (ICU4X line segmenter) instead of only at spaces; score unchanged (estimated) |
|
||||
| 2026-10-11 | minor | The Type tool's arrows and Delete move by grapheme cluster, never between a Thai consonant and its vowel or tone marks; score unchanged (estimated) |
|
||||
| 2026-10-11 | minor | Thai (Lao, Khmer, Myanmar) missing from the font in use falls back to an installed font made for the script instead of whichever face covering it loaded first; score unchanged (estimated) |
|
||||
|
||||
Reference in New Issue
Block a user