@@ -4,28 +4,28 @@ import { TextFontWeight } from "../../abstract-document/styles/text-style.js";
44import { getResources } from "../shared/get_resources.js" ;
55
66export function registerFonts (
7- registerFont : ( fontName : string , fontSource : AD . Font . FontSource , family : string ) => void ,
7+ registerFont : ( fontName : string , fontSource : AD . Font . FontSource ) => void ,
88 document : AD . AbstractDoc . AbstractDoc
99) : void {
1010 const resources = getResources ( document ) ;
1111 for ( const [ fontName , font ] of Object . entries ( resources . fonts ?? { } ) ) {
1212 // Required
13- registerFont ( fontName , font . normal , fontName ) ;
14- registerFont ( fontName + "-Bold" , font . bold , fontName ) ;
15- registerFont ( fontName + "-Oblique" , font . italic , fontName ) ;
16- registerFont ( fontName + "-Italic" , font . italic , fontName ) ;
17- registerFont ( fontName + "-BoldOblique" , font . boldItalic , fontName ) ;
18- registerFont ( fontName + "-BoldItalic" , font . boldItalic , fontName ) ;
13+ registerFont ( fontName , font . normal ) ;
14+ registerFont ( fontName + "-Bold" , font . bold ) ;
15+ registerFont ( fontName + "-Oblique" , font . italic ) ;
16+ registerFont ( fontName + "-Italic" , font . italic ) ;
17+ registerFont ( fontName + "-BoldOblique" , font . boldItalic ) ;
18+ registerFont ( fontName + "-BoldItalic" , font . boldItalic ) ;
1919 // Optional
20- registerFont ( fontName + "-Light" , font . light || font . normal , fontName ) ;
21- registerFont ( fontName + "-Medium" , font . medium || font . normal , fontName ) ;
22- registerFont ( fontName + "-ExtraBold" , font . extraBold || font . bold , fontName ) ;
23- registerFont ( fontName + "-LightOblique" , font . lightItalic || font . normal , fontName ) ;
24- registerFont ( fontName + "-LightItalic" , font . lightItalic || font . normal , fontName ) ;
25- registerFont ( fontName + "-MediumOblique" , font . mediumItalic || font . italic , fontName ) ;
26- registerFont ( fontName + "-MediumItalic" , font . mediumItalic || font . italic , fontName ) ;
27- registerFont ( fontName + "-ExtraBoldItalic" , font . extraBoldItalic || font . boldItalic , fontName ) ;
28- registerFont ( fontName + "-ExtraBoldOblique" , font . extraBoldItalic || font . boldItalic , fontName ) ;
20+ registerFont ( fontName + "-Light" , font . light || font . normal ) ;
21+ registerFont ( fontName + "-Medium" , font . medium || font . normal ) ;
22+ registerFont ( fontName + "-ExtraBold" , font . extraBold || font . bold ) ;
23+ registerFont ( fontName + "-LightOblique" , font . lightItalic || font . normal ) ;
24+ registerFont ( fontName + "-LightItalic" , font . lightItalic || font . normal ) ;
25+ registerFont ( fontName + "-MediumOblique" , font . mediumItalic || font . italic ) ;
26+ registerFont ( fontName + "-MediumItalic" , font . mediumItalic || font . italic ) ;
27+ registerFont ( fontName + "-ExtraBoldItalic" , font . extraBoldItalic || font . boldItalic ) ;
28+ registerFont ( fontName + "-ExtraBoldOblique" , font . extraBoldItalic || font . boldItalic ) ;
2929 }
3030}
3131
@@ -58,10 +58,10 @@ export function getFontNameStyle(textStyle: AD.TextStyle.TextStyle): string {
5858export function getFontStyleName ( attributes : Record < string , string > ) : keyof Font {
5959 const fontWeight = getFontWeightFromAttributes ( attributes ) ;
6060 const italic = attributes . italic === "true" ;
61- if ( fontWeight === "normal" ) {
61+ if ( fontWeight === "normal" ) {
6262 return italic ? "italic" : fontWeight ;
6363 }
64- return `${ fontWeight === "mediumBold" ? "medium" : fontWeight } ${ italic ? "Italic" : "" } ` ;
64+ return `${ fontWeight === "mediumBold" ? "medium" : fontWeight } ${ italic ? "Italic" : "" } ` ;
6565}
6666
6767export function getFontName (
0 commit comments