Skip to content

Commit a472716

Browse files
committed
[assembler] Prevent the use of underscores in glyph names.
1 parent a82ad2f commit a472716

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

assembler/src/asmlib/glyph.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,27 @@ fn test_superscript_char_agreement() {
196196
}
197197
}
198198

199+
#[test]
200+
fn test_glyph_names_do_not_contain_underscore() {
201+
// Because sup_ and sub_ use an underscore as a kind of separator,
202+
// it's probably too confusing to allow them in glyph names. So
203+
// this test prevents someone using one.
204+
//
205+
// I am currently also considering a convention in which a
206+
// combining character is specified by including the name of the
207+
// second character inside @...@. For example @square_minus@ to
208+
// denote a square (which does not advance the carriage) followed
209+
// by a minus sign (which does). This plan would require us to
210+
// treat '_' as a glyph name separator.
211+
for g in ALL_GLYPHS {
212+
assert!(
213+
!g.name.contains('_'),
214+
"glyph name {} should not contain an underscore",
215+
&g.name
216+
);
217+
}
218+
}
219+
199220
mod shape {
200221
#![allow(non_camel_case_types)]
201222

0 commit comments

Comments
 (0)