mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-02 19:12:40 +08:00
fix: Added asset path fallback null value inside an else clause
This commit is contained in:
committed by
Nathan Walker
parent
a21d4f94ac
commit
8726d026fe
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
2
packages/core/ui/styling/font.d.ts
vendored
2
packages/core/ui/styling/font.d.ts
vendored
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user