mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-14 21:44:57 +00:00
EPS import: KSC-Johab type reads one-byte ASCII codes
The KSC-Johab CMaps had no code space listed, so type in a font over KSC-Johab-H or KSC-Johab-V read every code as two bytes, so two ASCII characters moved the point one em instead of two. The code space now follows Adobe's KSC-Johab-H CMap: <00>-<80>, <8441>-<D3FE>, <D831>-<DEFE> and <E031>-<F9FE> (https://github.com/adobe-type-tools/cmap-resources/blob/master/Adobe-Korea1-2/CMap/KSC-Johab-H).
This commit is contained in:
@@ -279,6 +279,7 @@ fn code_space(cmap: &str) -> Option<CodeSpace> {
|
||||
const CNS_EUC: CodeSpace = &[(b"\x00", b"\x80"), (b"\xa1\xa1", b"\xfe\xfe"), (b"\x8e\xa1\xa1\xa1", b"\x8e\xa3\xfe\xfe")];
|
||||
const KSC_PC: CodeSpace = &[(b"\x00", b"\x84"), (b"\xfe", b"\xff"), (b"\xa1\x41", b"\xfd\xfe")];
|
||||
const UHC: CodeSpace = &[(b"\x00", b"\x80"), (b"\x81\x41", b"\xfe\xfe")];
|
||||
const JOHAB: CodeSpace = &[(b"\x00", b"\x80"), (b"\x84\x41", b"\xd3\xfe"), (b"\xd8\x31", b"\xde\xfe"), (b"\xe0\x31", b"\xf9\xfe")];
|
||||
let stem = match cmap {
|
||||
"H" | "V" => "",
|
||||
_ => cmap.strip_suffix("-H").or_else(|| cmap.strip_suffix("-V"))?,
|
||||
@@ -301,6 +302,7 @@ fn code_space(cmap: &str) -> Option<CodeSpace> {
|
||||
"CNS-EUC" => CNS_EUC,
|
||||
"KSCpc-EUC" => KSC_PC,
|
||||
"KSCms-UHC" => UHC,
|
||||
"KSC-Johab" => JOHAB,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -677,6 +677,10 @@ fn latin_names_ending_in_h_and_cmaps_that_cannot_be_read() {
|
||||
"/Ryumin-Light-GBT-H findfont 20 scalefont setfont <09092121> stringwidth abs 0.01 lt exch 60 sub abs 0.01 lt and",
|
||||
// A byte that starts no row-and-cell code is a code of its own, also before a tab: three.
|
||||
"/Ryumin-Light-GBT-H findfont 20 scalefont setfont <21092121> stringwidth abs 0.01 lt exch 60 sub abs 0.01 lt and",
|
||||
// In the Johab code space each ASCII byte is a one-byte code and a Hangul code takes two
|
||||
// bytes: three codes, across and down.
|
||||
"/Ryumin-Light-KSC-Johab-H findfont 20 scalefont setfont <41428441> stringwidth abs 0.01 lt exch 60 sub abs 0.01 lt and",
|
||||
"/Ryumin-Light-KSC-Johab-V findfont 20 scalefont setfont 10 100 moveto <41428441> show currentpoint 40 sub abs 0.01 lt exch 10 sub abs 0.01 lt and",
|
||||
] {
|
||||
let r = super::tests::read(&format!("{cond} {{ 0 0 10 10 rectfill }} if"));
|
||||
assert!(all(&r.document).iter().any(|n| matches!(n.kind, NodeKind::Path { .. })), "{cond}");
|
||||
|
||||
Reference in New Issue
Block a user