Merge pull request #1179 from CraftSpider/output-tests

Add more tex-output tests
This commit is contained in:
Rune Tynan 2024-04-17 14:59:43 -07:00 committed by GitHub
commit 19654bf152
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 136 additions and 11 deletions

View File

@ -154,6 +154,7 @@ fn main() {
)
.arg(
Arg::new("PATH")
.value_parser(clap::value_parser!(PathBuf))
.help("The path to the XDV or SPX file")
.required(true)
.index(1),

View File

@ -494,7 +494,14 @@ getGraphiteFeatureSettingCode(XeTeXLayoutEngine engine, uint32_t featureID, uint
return rval;
}
#define tag_from_lang(x) hb_tag_from_string(hb_language_to_string(x), strlen(hb_language_to_string(x)))
hb_tag_t tag_from_lang(hb_language_t lang) {
const char* str = hb_language_to_string(lang);
if (str) {
return hb_tag_from_string(str, strlen(str));
} else {
return 0;
}
}
uint32_t
getGraphiteFeatureDefaultSetting(XeTeXLayoutEngine engine, uint32_t featureID)
@ -595,17 +602,15 @@ findGraphiteFeatureNamed(XeTeXLayoutEngine engine, const char* name, int namelen
gr_face* grFace = hb_graphite2_face_get_gr_face(hbFace);
if (grFace != NULL) {
hb_tag_t tag = hb_tag_from_string(name, namelength);
for (int i = 0; i < gr_face_n_fref(grFace); i++) {
const gr_feature_ref* feature = gr_face_fref(grFace, i);
uint32_t len = 0;
uint16_t langID = 0x409;
// the first call is to get the length of the string
gr_fref_label(feature, &langID, gr_utf8, &len);
char* label = (char*) xmalloc(len);
label = (char*) gr_fref_label(feature, &langID, gr_utf8, &len);
char* label = (char*)gr_fref_label(feature, &langID, gr_utf8, &len);
if (strncmp(label, name, namelength) == 0) {
if (gr_fref_id(feature) == tag || strncmp(label, name, namelength) == 0) {
rval = gr_fref_id(feature);
gr_label_destroy(label);
break;
@ -627,17 +632,15 @@ findGraphiteFeatureSettingNamed(XeTeXLayoutEngine engine, uint32_t id, const cha
gr_face* grFace = hb_graphite2_face_get_gr_face(hbFace);
if (grFace != NULL) {
hb_tag_t tag = hb_tag_from_string(name, namelength);
const gr_feature_ref* feature = gr_face_find_fref(grFace, id);
for (int i = 0; i < gr_fref_n_values(feature); i++) {
uint32_t len = 0;
uint16_t langID = 0x409;
// the first call is to get the length of the string
gr_fref_value_label(feature, i, &langID, gr_utf8, &len);
char* label = (char*) xmalloc(len);
label = (char*) gr_fref_value_label(feature, i, &langID, gr_utf8, &len);
char* label = (char*)gr_fref_value_label(feature, i, &langID, gr_utf8, &len);
if (strncmp(label, name, namelength) == 0) {
if (gr_fref_id(feature) == tag || strncmp(label, name, namelength) == 0) {
rval = gr_fref_value(feature, i);
gr_label_destroy(label);
break;

Binary file not shown.

Binary file not shown.

View File

@ -199,6 +199,16 @@ fn file_encoding() {
.go()
}
// Works around an issue where old (~2.7) Harfbuzz lays out glyphs differently.
// Remove this once all external Harfbuzz versions don't exhibit the glyph-swapping behavior.
#[cfg(not(any(feature = "external-harfbuzz", target_arch = "x86")))]
#[test]
fn utf8_chars() {
TestCase::new("utf8_chars")
.expect(Ok(TexOutcome::Warnings))
.go();
}
/// An issue triggered by a bug in how the I/O subsystem reported file offsets
/// after an ungetc() call.
#[test]
@ -225,6 +235,11 @@ fn otf_basic() {
.go()
}
#[test]
fn graphite_basic() {
TestCase::new("graphite_basic").go()
}
#[test]
fn prim_creationdate() {
TestCase::new("prim_creationdate").go()
@ -338,3 +353,13 @@ fn tectoniccodatokens_ok() {
fn the_letter_a() {
TestCase::new("the_letter_a").check_pdf(true).go()
}
#[test]
fn xetex_g_builtins() {
TestCase::new("xetex_g_builtins").check_pdf(true).go()
}
#[test]
fn xetex_ot_builtins() {
TestCase::new("xetex_ot_builtins").check_pdf(true).go()
}

View File

@ -0,0 +1,3 @@
**
(graphite_basic.tex [1] )
Output written on graphite_basic.xdv (1 page, 372 bytes).

View File

@ -0,0 +1,5 @@
\font\g="[LinLibertine_R_G]/GR:ss05=True"
% The LinLibertine ss05 W is the same style as Wikipedia - this just makes sure the feature is enabled correctly.
\g Wikipedia
\bye

Binary file not shown.

View File

@ -0,0 +1,13 @@
**
(utf8_chars.tex
Missing character: There is no א (U+05D0) in font [lmroman12-regular]!
Missing character: There is no ֳ (U+05B3) in font [lmroman12-regular]!
Missing character: There is no ר (U+05E8) in font [lmroman12-regular]!
Missing character: There is no ָ (U+05B8) in font [lmroman12-regular]!
Missing character: There is no נ (U+05E0) in font [lmroman12-regular]!
Missing character: There is no ִ (U+05B4) in font [lmroman12-regular]!
Missing character: There is no י (U+05D9) in font [lmroman12-regular]!
Missing character: There is no ם (U+05DD) in font [lmroman12-regular]!
Missing character: There is no ֳ (U+05B3) in font [lmroman12-regular]!
[1] )
Output written on utf8_chars.xdv (1 page, 728 bytes).

View File

@ -0,0 +1,8 @@
% Examples of non-ASCII/Latin text
\font\r="[lmroman12-regular]"
% Missing in font - intentional
\r Hebrew: אֳרָנִים
\r Hebrew modifier on Latin: 9ֳ9
\bye

Binary file not shown.

View File

@ -0,0 +1,3 @@
**
(xetex_g_builtins.tex [1] )
Output written on xetex_g_builtins.xdv (1 page, 760 bytes).

Binary file not shown.

View File

@ -0,0 +1,33 @@
\font\g="[LinLibertine_R_G]/GR"
Features: \the\XeTeXcountfeatures \g
- Code: \the\XeTeXfeaturecode \g 0
- Name: \XeTeXfeaturename \g 1664250723
- Code: \the\XeTeXfeaturecode \g 1
- Name: \XeTeXfeaturename \g 1667330917
- Code: \the\XeTeXfeaturecode \g 2
- Name: \XeTeXfeaturename \g 1684826471
- Code: \the\XeTeXfeaturecode \g 3
- Name: \XeTeXfeaturename \g 1718185569
- Selectors: \the\XeTeXcountselectors \g 1718185569
- - Default is False: \the\XeTeXisdefaultselector \g 1718185569 0
- - Code: \the\XeTeXselectorcode \g 1718185569 0
- - Name: \XeTeXselectorname \g 1718185569 0
- - Code: \the\XeTeXselectorcode \g 1718185569 1
- - Name: \XeTeXselectorname \g 1718185569 1
\bye

Binary file not shown.

View File

@ -0,0 +1,3 @@
**
(xetex_ot_builtins.tex [1] )
Output written on xetex_ot_builtins.xdv (1 page, 664 bytes).

Binary file not shown.

View File

@ -0,0 +1,28 @@
\font\i="[Inconsolatazi4-Regular.otf]/OT"
Scripts: \the\XeTeXOTcountscripts \i
Script 0: \the\XeTeXOTscripttag \i 0
- Languages: \the\XeTeXOTcountlanguages \i 1145457748
- - Features: \the\XeTeXOTcountfeatures \i 1145457748 0
- - Feature 0: \the\XeTeXOTfeaturetag \i 1145457748 0 0
- - Feature 1: \the\XeTeXOTfeaturetag \i 1145457748 0 1
- - Feature 2: \the\XeTeXOTfeaturetag \i 1145457748 0 2
Script 1: \the\XeTeXOTscripttag \i 1
- Languages: \the\XeTeXOTcountlanguages \i 1
- - Features: \the\XeTeXOTcountfeatures \i 1818326126 0
- - Feature 0: \the\XeTeXOTfeaturetag \i 1818326126 0 0
- - Feature 1: \the\XeTeXOTfeaturetag \i 1818326126 0 1
- - Feature 2: \the\XeTeXOTfeaturetag \i 1818326126 0 2
\bye

Binary file not shown.