File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
src/renderer/html_handlebars Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,8 @@ impl HtmlHandlebars {
275275 "FontAwesome/fonts/FontAwesome.ttf" ,
276276 theme:: FONT_AWESOME_TTF ,
277277 ) ?;
278- if html_config. copy_fonts {
278+ // Don't copy the stock fonts if the user has specified their own fonts to use.
279+ if html_config. copy_fonts && theme. fonts_css . is_none ( ) {
279280 write_file ( destination, "fonts/fonts.css" , theme:: fonts:: CSS ) ?;
280281 for ( file_name, contents) in theme:: fonts:: LICENSES . iter ( ) {
281282 write_file ( destination, file_name, contents) ?;
Original file line number Diff line number Diff line change @@ -891,19 +891,19 @@ fn custom_fonts() {
891891 assert_eq ! ( actual_files( & p. join( "book/fonts" ) ) , & builtin_fonts) ;
892892 assert ! ( has_fonts_css( p) ) ;
893893
894- // Mixed with copy_fonts =true
895- // This should generate a deprecation warning .
894+ // Mixed with copy-fonts =true
895+ // Should ignore the copy-fonts setting since the user has provided their own fonts.css .
896896 let temp = TempFileBuilder :: new ( ) . prefix ( "mdbook" ) . tempdir ( ) . unwrap ( ) ;
897897 let p = temp. path ( ) ;
898898 MDBook :: init ( p) . build ( ) . unwrap ( ) ;
899899 write_file ( & p. join ( "theme/fonts" ) , "fonts.css" , b"/*custom*/" ) . unwrap ( ) ;
900900 write_file ( & p. join ( "theme/fonts" ) , "myfont.woff" , b"" ) . unwrap ( ) ;
901901 MDBook :: load ( p) . unwrap ( ) . build ( ) . unwrap ( ) ;
902902 assert ! ( has_fonts_css( p) ) ;
903- let mut expected = Vec :: from ( builtin_fonts ) ;
904- expected . push ( "myfont.woff" ) ;
905- expected . sort ( ) ;
906- assert_eq ! ( actual_files ( & p . join ( "book/fonts" ) ) , expected . as_slice ( ) ) ;
903+ assert_eq ! (
904+ actual_files ( & p . join ( "book/fonts" ) ) ,
905+ [ "fonts.css" , "myfont.woff" ]
906+ ) ;
907907
908908 // copy-fonts=false, no theme
909909 // This should generate a deprecation warning.
You can’t perform that action at this time.
0 commit comments