Skip to content

Commit

Permalink
Add missing font test cases (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV authored Feb 12, 2024
1 parent 49d08a5 commit 176d384
Show file tree
Hide file tree
Showing 54 changed files with 646 additions and 156 deletions.
626 changes: 602 additions & 24 deletions NOTICE

Large diffs are not rendered by default.

Binary file added tests/fonts/Amiri-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/MPLUS1p-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/NotoEmoji-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/NotoMono-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/NotoSans-Black.ttf
Binary file not shown.
Binary file added tests/fonts/NotoSans-Light.ttf
Binary file not shown.
Binary file added tests/fonts/NotoSans-Thin.ttf
Binary file not shown.
Binary file added tests/fonts/NotoSansDevanagari-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/NotoSerif-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/SedgwickAveDisplay-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/SourceSansPro-Regular.ttf
Binary file not shown.
Binary file added tests/fonts/Yellowtail-Regular.ttf
Binary file not shown.
21 changes: 0 additions & 21 deletions tests/ref/resvg/LICENSE

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/direction/rtl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/dominant-baseline/hanging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/font-family/cursive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/font-family/fallback-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/font-family/fantasy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/resvg/text/font-family/font-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/font-family/monospace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/font-family/sans-serif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/font-family/serif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/font/simple-case.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/letter-spacing/on-Arabic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/text/bidi-reordering.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/text/fill-rule=evenodd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/text/rotate-on-Arabic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/text/xml-lang=ja.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/ref/resvg/text/textLength/arabic.png
Binary file added tests/ref/resvg/text/textPath/complex.png
Binary file added tests/ref/resvg/text/textPath/writing-mode=tb.png
Binary file added tests/ref/resvg/text/tspan/bidi-reordering.png
Binary file modified tests/ref/resvg/text/writing-mode/tb-and-punctuation.png
40 changes: 1 addition & 39 deletions tests/scripts/gen-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,47 +79,9 @@
"svg/resvg/paint-servers/radialGradient/attributes-via-xlink-href-from-linearGradient.svg": NO_REFLECT,
"svg/resvg/paint-servers/radialGradient/spreadMethod=reflect.svg": NO_REFLECT,
"svg/resvg/paint-servers/radialGradient/spreadMethod=repeat.svg": NO_REPEAT,

# The following test cases don't work yet because we are not including
# all necessary fonts.
"svg/resvg/text/alignment-baseline/hanging-on-vertical.svg": NO_FONT,
"svg/resvg/text/direction/rtl.svg": NO_FONT,
"svg/resvg/text/direction/rtl-with-vertical-writing-mode.svg": NO_FONT,
"svg/resvg/text/dominant-baseline/hanging.svg": NO_FONT,
"svg/resvg/text/dominant-baseline/use-script.svg": NO_FONT,
"svg/resvg/text/font/simple-case.svg": NO_FONT,
"svg/resvg/text/font-family/bold-sans-serif.svg": NO_FONT,
"svg/resvg/text/font-family/cursive.svg": NO_FONT,
"svg/resvg/text/font-family/fallback-1.svg": NO_FONT,
"svg/resvg/text/font-family/fantasy.svg": NO_FONT,
"svg/resvg/text/font-family/monospace.svg": NO_FONT,
"svg/resvg/text/font-family/sans-serif.svg": NO_FONT,
"svg/resvg/text/font-family/serif.svg": NO_FONT,
"svg/resvg/text/font-family/source-sans-pro.svg": NO_FONT,
"svg/resvg/text/font-kerning/arabic-script.svg": NO_FONT,
"svg/resvg/text/letter-spacing/non-ASCII-character.svg": NO_FONT,
"svg/resvg/text/letter-spacing/on-Arabic.svg": NO_FONT,
"svg/resvg/text/text/bidi-reordering.svg": NO_FONT,
"svg/resvg/text/text/fill-rule=evenodd.svg": NO_FONT,
"svg/resvg/text/text/rotate-on-Arabic.svg": NO_FONT,
"svg/resvg/text/text/x-and-y-with-multiple-values-and-arabic-text.svg": NO_FONT,
"svg/resvg/text/text/xml-lang=ja.svg": NO_FONT,
"svg/resvg/text/text-anchor/on-tspan-with-arabic.svg": NO_FONT,
"svg/resvg/text/textLength/arabic.svg": NO_FONT,
"svg/resvg/text/textLength/arabic-with-lengthAdjust.svg": NO_FONT,
"svg/resvg/text/textPath/complex.svg": NO_FONT,
"svg/resvg/text/textPath/writing-mode=tb.svg": NO_FONT,
"svg/resvg/text/tspan/bidi-reordering.svg": NO_FONT,
"svg/resvg/text/unicode-bidi/bidi-override.svg": NO_FONT,
"svg/resvg/text/writing-mode/arabic-with-rl.svg": NO_FONT,
"svg/resvg/text/writing-mode/japanese-with-tb.svg": NO_FONT,
"svg/resvg/text/writing-mode/mixed-languages-with-tb.svg": NO_FONT,
"svg/resvg/text/writing-mode/mixed-languages-with-tb-and-underline.svg": NO_FONT,
"svg/resvg/text/writing-mode/tb-and-punctuation.svg": NO_FONT,
"svg/resvg/text/writing-mode/tb-with-rotate.svg": NO_FONT,
"svg/resvg/text/writing-mode/tb-with-rotate-and-underline.svg": NO_FONT,
}


def main():
parser = argparse.ArgumentParser(
prog="gen-tests", description="Generate the test files for svg2pdf"
Expand Down
7 changes: 7 additions & 0 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ use svg2pdf::Options;
static FONTDB: Lazy<std::sync::Mutex<fontdb::Database>> = Lazy::new(|| {
let mut fontdb = fontdb::Database::new();
fontdb.load_fonts_dir("fonts");

fontdb.set_serif_family("Noto Serif");
fontdb.set_sans_serif_family("Noto Sans");
fontdb.set_cursive_family("Yellowtail");
fontdb.set_fantasy_family("Sedgwick Ave Display");
fontdb.set_monospace_family("Noto Mono");

std::sync::Mutex::new(fontdb)
});

Expand Down
108 changes: 36 additions & 72 deletions tests/src/test.rs

Large diffs are not rendered by default.

0 comments on commit 176d384

Please sign in to comment.