From b0a1bd47bcf7934815b1ca93d03cbd6dc868cba6 Mon Sep 17 00:00:00 2001 From: Max Melander Date: Fri, 4 Oct 2024 13:20:50 +0800 Subject: [PATCH 1/2] Adds test to cover issue #136 Adds test to cover the issue where the avar table was beeing applied to the same coordinate multiple times when calling set_variations. This test will pass when commit 1cac7c7 from ttf-parser starts being used. --- .../0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf | Bin 0 -> 3196 bytes tests/shaping/in_house.rs | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/fonts/in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf diff --git a/tests/fonts/in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf b/tests/fonts/in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf new file mode 100644 index 0000000000000000000000000000000000000000..e664befb985b20aafed2a9f95e71bcd7ed11aedb GIT binary patch literal 3196 zcmbVOTWnNC82;v*-R*X7y|8U*fqEzvDwhS?rV^`A6iQXJ4Q+}sQCLdpqPuNvmz#!! zwfJC+iI~U(X+nJP3J)d{4AF6cQ5A7#~oeg_iZ3IkVl;Rzo?PGxPoT z%lvb)5CC$yIDm%M)f+zZfAczE93%HwWAoC=-bHP%kZvKpxw&O^OYG~@p8#frbTYg% z-1C&D$q9%LNH1=Sg}dQHg7kIL)!QidyKj}#c?IboI>No(D8M|*XOqtDi0;|;>MY-B z(%(t@4(gw~`{)4m|0J&=(jMOW$j5(t#Q0LbCPIe)N5?yqMM;-OV)5Os-^51JLDKGM zS6di`L=ZkMu2^_?H|F97>BXe2&Ty>#(jB9OqH4Yk-Ce!$)L~RozFx}tLfSjd;CpHv zgn$V*Jn$ncl|l|_rh)_1*#xJel!;nQrLAD9U;3Qlp}qV4(a(YGPw)1RR%iE5@FBg+ z7;<+ekyOw^uyq+Kj@F@$jZbqGC2%lxP3*_-@B)ul*Hl#&76e`M%H|(jv%IRlzH0fJ zNPTT>{n}Nlq$h)~$v4PVMhWuFE$$BfBpqUnYE7NjSxBylldW%jdv#OJlQ-dYlL7qt z)4*-HUw!NH7p&uacE5WINtcQs1rEmnP6X$|S;bxghwR-rgG%E=sW9%5F~**Cjg9L> z5+Q`_KDqB1@9}gFO9e-R^Efw4XA8)gkmqhcxhlHdzdD5%QIM-D$s!WunY4Anbv9IU z#3-s(B4>tu`L^?~Y?4{&9@~y(=QAjcZH}!ueuX+In`57u_9ht4t^4nx^@oCe38vn-eFcRW(f9A zeQ_ie6khE`QU&tnt6C&gDE!)sq>5w*n7^Ec67KS;QR}-EN98FcQK#;l+~qk!QTwt; zmcoV7I_3){BX&r+)T7MgD=+|R2Wc%_w9#5XnmxH2&CpE%|Ln(83czD0RtgNVbZZH^}TU=a*>V$W6 zh{C@|jhi=brutaZJnyz}F4Wj0wlsER{Bw?S&0NiQ!EMTW#@skV`Nl1cvr%eX(%6GC-#X<*r~A}^Nl8r1H|bZa-35YK5G#FHYR zaRFB1oW_Nm!$TSuacExFcqa1Epm8y0Hl%S0d??d+7IC4*vxz+#&mjUfpbIgC(TQgf z=N`p&wBZG`^9F9m4$5AnMvu~oqM7^{`OlEoNsV@{y-Ig7rxD#s-mJX$j*GNp3j4ME zhQ%2tjHl^4O5fA7e>kgjJr8HSf%SE;M^R?oGtGS0vx^;wu;%}(b9!BQkSeBA@q^cw zsb=yVSeRVJR9flmr;<&~dMcg!vzaUU;;oYRuNT$?+l+24)=|HaYweg_+G=9N`{SplD-%U_ zrW<>hRk{X?|3;Uo*W&+)2s5_EqGaqWG|{FDuTkE{K3G`I*_Zv0-v^m}g_`F$z4zh? pEak6*F{H*0Y+>DP)Ql-^7f}cAO*^&`byBC7e3_U1MX~$w*uOEa1SJ3f literal 0 HcmV?d00001 diff --git a/tests/shaping/in_house.rs b/tests/shaping/in_house.rs index dd05f81a..6c0cb804 100644 --- a/tests/shaping/in_house.rs +++ b/tests/shaping/in_house.rs @@ -18418,6 +18418,18 @@ fn variations_005() { ); } +#[test] +fn variations_006() { + assert_eq!( + shape( + "tests/fonts/in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf", + "\u{0065}", + "--variations=wght=500,wdth=80", + ), + "gid0=0+1218" + ); +} + #[test] fn vertical_001() { assert_eq!( From d3b6d9b2a8b2bd7eacac492ca173588aa0ed9734 Mon Sep 17 00:00:00 2001 From: Max Melander Date: Fri, 4 Oct 2024 16:16:06 +0800 Subject: [PATCH 2/2] Puts stuff in the right place --- tests/custom/bugs.tests | 3 +- tests/fonts/rb_custom/OpenSans-OFL.txt | 93 ++++++++++++++++++ .../OpenSans.subset1.ttf} | Bin tests/shaping/custom.rs | 12 +++ tests/shaping/in_house.rs | 12 --- 5 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 tests/fonts/rb_custom/OpenSans-OFL.txt rename tests/fonts/{in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf => rb_custom/OpenSans.subset1.ttf} (100%) diff --git a/tests/custom/bugs.tests b/tests/custom/bugs.tests index 819c0415..973c3292 100644 --- a/tests/custom/bugs.tests +++ b/tests/custom/bugs.tests @@ -1 +1,2 @@ -tests/fonts/rb_custom/NotoSansCJK.subset1.otf;--direction rtl;U+4F60,U+597D,U+FF0C; \ No newline at end of file +tests/fonts/rb_custom/NotoSansCJK.subset1.otf;--direction rtl;U+4F60,U+597D,U+FF0C; +tests/fonts/rb_custom/OpenSans.subset1.ttf;--variations=wght=500,wdth=80;U+0065; diff --git a/tests/fonts/rb_custom/OpenSans-OFL.txt b/tests/fonts/rb_custom/OpenSans-OFL.txt new file mode 100644 index 00000000..4fc61702 --- /dev/null +++ b/tests/fonts/rb_custom/OpenSans-OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Open Sans Project Authors (https://github.com/googlefonts/opensans) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/tests/fonts/in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf b/tests/fonts/rb_custom/OpenSans.subset1.ttf similarity index 100% rename from tests/fonts/in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf rename to tests/fonts/rb_custom/OpenSans.subset1.ttf diff --git a/tests/shaping/custom.rs b/tests/shaping/custom.rs index d0f73b30..445f2028 100644 --- a/tests/shaping/custom.rs +++ b/tests/shaping/custom.rs @@ -16,6 +16,18 @@ fn bugs_001() { ); } +#[test] +fn bugs_002() { + assert_eq!( + shape( + "tests/fonts/rb_custom/OpenSans.subset1.ttf", + "\u{0065}", + "--variations=wght=500,wdth=80", + ), + "gid0=0+1218" + ); +} + #[test] fn fuzzer_001() { assert_eq!( diff --git a/tests/shaping/in_house.rs b/tests/shaping/in_house.rs index 6c0cb804..dd05f81a 100644 --- a/tests/shaping/in_house.rs +++ b/tests/shaping/in_house.rs @@ -18418,18 +18418,6 @@ fn variations_005() { ); } -#[test] -fn variations_006() { - assert_eq!( - shape( - "tests/fonts/in-house/0bed094c61114e8b3d30810e4ac51dc0a46e64ca.ttf", - "\u{0065}", - "--variations=wght=500,wdth=80", - ), - "gid0=0+1218" - ); -} - #[test] fn vertical_001() { assert_eq!(