diff --git a/packages/core/ui/styling/font-common.ts b/packages/core/ui/styling/font-common.ts index 2aea33725..3a0b35bf7 100644 --- a/packages/core/ui/styling/font-common.ts +++ b/packages/core/ui/styling/font-common.ts @@ -3,7 +3,7 @@ import { ParsedFont, FontStyleType, FontWeightType, FontVariationSettingsType } import { makeValidator, makeParser } from '../core/properties'; import { Trace } from '../../trace'; -export const FONTS_BASE_PATH = '/fonts/'; +export const FONTS_BASE_PATH = '/fonts'; export abstract class Font implements FontDefinition { public static default = undefined; diff --git a/packages/core/ui/styling/font.android.ts b/packages/core/ui/styling/font.android.ts index dd4a32232..185de0bce 100644 --- a/packages/core/ui/styling/font.android.ts +++ b/packages/core/ui/styling/font.android.ts @@ -78,9 +78,12 @@ function loadFontFromFile(fontFamily: string, font: Font): android.graphics.Type fontAssetPath = basePath + '.ttf'; } else if (fs.File.exists(basePath + '.otf')) { fontAssetPath = basePath + '.otf'; - } else if (Trace.isEnabled()) { + } else { fontAssetPath = null; - Trace.write('Could not find font file for ' + fontFamily, Trace.categories.Error, Trace.messageType.error); + + if (Trace.isEnabled()) { + Trace.write('Could not find font file for ' + fontFamily, Trace.categories.Error, Trace.messageType.error); + } } result = null; // Default @@ -108,7 +111,7 @@ function loadFontFromFile(fontFamily: string, font: Font): android.graphics.Type } } - // The value might be null if there has already been an attempt to load the font but failed + // The value will be null if there has already been an attempt to load the font but failed typefaceCache.set(cacheKey, result); } diff --git a/packages/core/ui/styling/font.d.ts b/packages/core/ui/styling/font.d.ts index 650b715b7..bbbc8ae85 100644 --- a/packages/core/ui/styling/font.d.ts +++ b/packages/core/ui/styling/font.d.ts @@ -1,7 +1,7 @@ import { Font as FontBase } from './font-common'; export type { FontStyleType, FontWeightType, ParsedFont, FontVariationSettingsType } from './font-interfaces'; -export const FONTS_BASE_PATH = '/fonts/'; +export const FONTS_BASE_PATH = '/fonts'; export declare class Font extends FontBase { public static default: Font;