From dac70f252a84e1a255375eaacffc2cb3f3fc6e58 Mon Sep 17 00:00:00 2001 From: Michiharu Ariza Date: Wed, 26 Sep 2018 16:30:26 -0700 Subject: [PATCH] Added CFF1 J font subset to api test Also fixed FDSelect3_4::get_fd Fixed test_subset_cff1_strip_hints (wrong font names!) --- src/hb-ot-cff-common.hh | 2 +- .../SourceHanSans-Regular.41,3041,4E9D.otf | Bin 0 -> 5864 bytes .../fonts/SourceHanSans-Regular.41,4E9D.otf | Bin 0 -> 5500 bytes test/api/test-subset-cff1.c | 25 ++++++++++++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 test/api/fonts/SourceHanSans-Regular.41,3041,4E9D.otf create mode 100644 test/api/fonts/SourceHanSans-Regular.41,4E9D.otf diff --git a/src/hb-ot-cff-common.hh b/src/hb-ot-cff-common.hh index 3bebf3bfa..b036ae53f 100644 --- a/src/hb-ot-cff-common.hh +++ b/src/hb-ot-cff-common.hh @@ -576,7 +576,7 @@ struct FDSelect3_4 { if (glyph < ranges[i].first) return (hb_codepoint_t)ranges[i - 1].fd; - assert (false); + return (hb_codepoint_t)ranges[nRanges - 1].fd; } inline GID_TYPE &sentinel (void) { return StructAfter (ranges[nRanges - 1]); } diff --git a/test/api/fonts/SourceHanSans-Regular.41,3041,4E9D.otf b/test/api/fonts/SourceHanSans-Regular.41,3041,4E9D.otf new file mode 100644 index 0000000000000000000000000000000000000000..f433cedab32ee5ec16f86d75c59e0b298d91eeea GIT binary patch literal 5864 zcmcIo3v?6LnZBc!jV+7`QR0GQZYT>TF|u$Bo5l2O1dg$=BN@xQ+c;xsEDK9BLK@qM z66%%&KQM;Gg@z;qHY9Cm*n~n(lV%H{p^(QmrXh!%?WXPNcDuWDcXN{6?REeeyx%`F z!a$s!ZO^H6X72yG|NZa(xc8R=O-%vjWZlfl?psn*!%Mrp7RK057_;{Vg5?z}w>qC= z%rOAkLn{M~ORXCKF~@)6l^cqS36JEz3;6GVcehDmc*4I(mw`6{U(g1EbMl1K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GHQ@VL6N2sE*HwEp+xKTbo-`qE4atanxWD{7K&Udmc zhLJoMK@JCyyY-0A*j@jbyItPp8SXphdByXp=alDVSaZWoe-qdEC5<18qg(0!-*G-d iArpRg6~DgeH}sWt_zj)?C7cx&^nV?O@c;1LjQt;Js@+Eb literal 0 HcmV?d00001 diff --git a/test/api/fonts/SourceHanSans-Regular.41,4E9D.otf b/test/api/fonts/SourceHanSans-Regular.41,4E9D.otf new file mode 100644 index 0000000000000000000000000000000000000000..3fe907ea08d6c75f3155135533549e1f37899214 GIT binary patch literal 5500 zcmcIo4RBP|6~1r(5|SkZbv0!oy=Eu`37ZfDGK9{sB!n!9yCEAup*6njzU)4-``+^2 zOG5l>X6zXL#2*SHqx=kLEe@krm}$ofQZQg01*KD`*0y6?+tSWBTHCt72GZ}m_cnnT zoa&6b^WHt@o^!u@?m6e4dw0WaZDHnR{mjW0)ipHmr|R41GREFw%r!3@sjOc4kar(r z?uF>PXJxo`sdF7D=6)Kl{Afx{@0!xG3H&qQlL<+TP57&H5xfihyaYPDlP3%^<|zh0 zEs-+T7gVzS;A_BpQ{wtGbGCr=ETWeprljM=E?{{Y87ul*TGfr=hgmgazADIh5AY^D zcoPRtgQoQW&vhT01>OLkFEE#j34(BAMD5n1QlqFuL`9$7D#g2#qDGSMl?t0mh0UA2 zQ%i*bp;Xx5C>1t3ONAf0vbTDjmmj=*@Mgve(|F|-ySMDPnLYB*vqe*r=o=pP zmZ1?on?&!7_d94D9`7`2ZlBEZ9ZZ1Z{=zeMr@lG#gQxP2J``48UkBo2`a9fGH z1u~cKI_9Lnh1oXY$*lLt#gZe!Cr2){9C3b<_4+OxzIgwo!=CfghT47Ev*%~KFBE&S zFAuHsWr(?SGVfAVhe>D74uP+_@Cmq~*;(R>_V#3q-(-f~6SkiJ*qMoBj{08AxSsvv z{@?BU)3+Y=?4P%<_Q&&I$hu0-Wsmwk_GBNqu+BXV&82nje|XMj40mR)r>Ol*X4czp z470j^q~B}(>~zQLD_+m6dAI$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t2ul+ ziroUtt9ugAGE846SZ_||XY&z{TC7!MUBDxqPT(Yg+5w55&BZg1-3E)R&|c|_FSqnc zO%62jjEKj8%@iGqE%~PleJbYsx)~sw-lvFCv{rzl_*(IdfUP_$;PH(=xN~*t)io`UmP3p3hCDJI zk8FBGMc$Bi(pZg-e659~1w7>vN4EI!ZnP~WjAqCTj8)9cUW&02zT{EDth4uC(u`)* z##;pq1wEAMacHduVgS}IWxSnB1ABI&uN<+by{jTd6dTnZYh@+vEW)H2NF!xhB*TlA zHH6HMy>#fU(;xlfnU~)S9+9s^%%r&!oJ<|q3_tdiv9>3aB% zyxU}s=I|`pM_Eeqq#;$=T5wTdQ65t@NZ6T1eN@ZhK9-sKwxvuDz!;s``y&C6Q zIrc@L&BUt6U;j@%HO$pY*imh!FKCaAR#1v{Cy;t!G38~h22f?8N~)MXqNLJ655;4bcf>$G4e$01;}1P6&JuHJip#)M)R7(OYkh2%5AdYk-XO??T%IDd`Zl z1gl0Xmc-VZSxMPTez$6xjOJXUpjd?Yw-Iy_e(gZESUc;Y-6+j2g)cuz5oCK literal 0 HcmV?d00001 diff --git a/test/api/test-subset-cff1.c b/test/api/test-subset-cff1.c index 62ce80283..ae32c435d 100644 --- a/test/api/test-subset-cff1.c +++ b/test/api/test-subset-cff1.c @@ -71,8 +71,8 @@ test_subset_cff1 (void) static void test_subset_cff1_strip_hints (void) { - hb_face_t *face_abc = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.abc.ttf"); - hb_face_t *face_ac = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.ac.nohints.ttf"); + hb_face_t *face_abc = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.abc.otf"); + hb_face_t *face_ac = hb_subset_test_open_font ("fonts/SourceSansPro-Regular.ac.nohints.otf"); hb_set_t *codepoints = hb_set_create (); hb_subset_input_t *input; @@ -91,6 +91,26 @@ test_subset_cff1_strip_hints (void) hb_face_destroy (face_ac); } +static void +test_subset_cff1_j (void) +{ + hb_face_t *face_41_3041_4e9d = hb_subset_test_open_font ("fonts/SourceHanSans-Regular.41,3041,4E9D.otf"); + hb_face_t *face_41_4e9d = hb_subset_test_open_font ("fonts/SourceHanSans-Regular.41,4E9D.otf"); + + hb_set_t *codepoints = hb_set_create (); + hb_face_t *face_41_3041_4e9d_subset; + hb_set_add (codepoints, 0x41); + hb_set_add (codepoints, 0x4E9D); + face_41_3041_4e9d_subset = hb_subset_test_create_subset (face_41_3041_4e9d, hb_subset_test_create_input (codepoints)); + hb_set_destroy (codepoints); + + hb_subset_test_check (face_41_4e9d, face_41_3041_4e9d_subset, HB_TAG ('C','F','F',' ')); + + hb_face_destroy (face_41_3041_4e9d_subset); + hb_face_destroy (face_41_3041_4e9d); + hb_face_destroy (face_41_4e9d); +} + int main (int argc, char **argv) { @@ -99,6 +119,7 @@ main (int argc, char **argv) hb_test_add (test_subset_cff1_noop); hb_test_add (test_subset_cff1); hb_test_add (test_subset_cff1_strip_hints); + hb_test_add (test_subset_cff1_j); return hb_test_run (); }