Skip to content

Commit 8726d02

Browse files
CatchABusNathanWalker
authored andcommitted
fix: Added asset path fallback null value inside an else clause
1 parent a21d4f9 commit 8726d02

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

packages/core/ui/styling/font-common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ParsedFont, FontStyleType, FontWeightType, FontVariationSettingsType }
33
import { makeValidator, makeParser } from '../core/properties';
44
import { Trace } from '../../trace';
55

6-
export const FONTS_BASE_PATH = '/fonts/';
6+
export const FONTS_BASE_PATH = '/fonts';
77

88
export abstract class Font implements FontDefinition {
99
public static default = undefined;

packages/core/ui/styling/font.android.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ function loadFontFromFile(fontFamily: string, font: Font): android.graphics.Type
7878
fontAssetPath = basePath + '.ttf';
7979
} else if (fs.File.exists(basePath + '.otf')) {
8080
fontAssetPath = basePath + '.otf';
81-
} else if (Trace.isEnabled()) {
81+
} else {
8282
fontAssetPath = null;
83-
Trace.write('Could not find font file for ' + fontFamily, Trace.categories.Error, Trace.messageType.error);
83+
84+
if (Trace.isEnabled()) {
85+
Trace.write('Could not find font file for ' + fontFamily, Trace.categories.Error, Trace.messageType.error);
86+
}
8487
}
8588

8689
result = null; // Default
@@ -108,7 +111,7 @@ function loadFontFromFile(fontFamily: string, font: Font): android.graphics.Type
108111
}
109112
}
110113

111-
// The value might be null if there has already been an attempt to load the font but failed
114+
// The value will be null if there has already been an attempt to load the font but failed
112115
typefaceCache.set(cacheKey, result);
113116
}
114117

packages/core/ui/styling/font.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Font as FontBase } from './font-common';
22
export type { FontStyleType, FontWeightType, ParsedFont, FontVariationSettingsType } from './font-interfaces';
33

4-
export const FONTS_BASE_PATH = '/fonts/';
4+
export const FONTS_BASE_PATH = '/fonts';
55

66
export declare class Font extends FontBase {
77
public static default: Font;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy