File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 2323 height :1000px ;
2424 }
2525}
26+
27+ @font-face {
28+ font-family : JDZH- Light;
29+ src : url (' https://wq.360buyimg.com/data/ppms/others/JDZH_Light.ttf' ) format (' truetype' );
30+ }
31+
32+ @font-face {
33+ font-family : JDZH- Regular;
34+ src : url (' https://wq.360buyimg.com/data/ppms/others/JDZH_Regular.ttf' ) format (' truetype' );
35+ }
36+
37+ @font-face {
38+ font-family : JDZH- Bold;
39+ src : url (' https://wq.360buyimg.com/data/ppms/others/JDZH_Bold.ttf' ) format (' truetype' );
40+ }
41+
42+ @font-face {
43+ font-family : JDZhengHT- EN- Bold;
44+ src : url (' https://wq.360buyimg.com/data/ppms/others/JDZhengHei_01_Bold.ttf' ) format (' truetype' );
45+ }
46+
47+ @font-face {
48+ font-family : JDZhengHT- EN- Regular;
49+ src : url (' https://wq.360buyimg.com/data/ppms/others/JDZH_Regular.ttf' ) format (' truetype' );
50+ }
51+
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ impl<'i> Visitor<'i> for StyleVisitor<'i> {
248248 if let Some ( next) = source. iter ( ) . next ( ) {
249249 match next {
250250 Source :: Url ( value) => {
251- font_face. src = value. url . to_css_string ( PrinterOptions :: default ( ) ) . unwrap ( ) ;
251+ font_face. src = value. url . url . as_ref ( ) . to_string ( ) ;
252252 } ,
253253 _ => { }
254254 }
@@ -284,7 +284,15 @@ impl<'i> Visitor<'i> for StyleVisitor<'i> {
284284 _ => { }
285285 } ;
286286 if !font_face. font_family . is_empty ( ) && !font_face. src . is_empty ( ) {
287- self . all_fonts . borrow_mut ( ) . push ( font_face. clone ( ) ) ;
287+ let mut all_fonts = self . all_fonts . borrow_mut ( ) ;
288+ let has_font_index = all_fonts
289+ . iter ( )
290+ . position ( |font| font. font_family == font_face. font_family ) ;
291+ if let Some ( index) = has_font_index {
292+ all_fonts[ index] = font_face. clone ( ) ;
293+ } else {
294+ all_fonts. push ( font_face. clone ( ) ) ;
295+ }
288296 }
289297 } ) ;
290298 } ,
You can’t perform that action at this time.
0 commit comments