fix: dont default to Font.default (#8401)

* fix: dont default to Font.default

This would cause a font to be set for any label even when using default system font.
This will also cause a typeface which is pretty long

* lint: lint fixes

* fix: added null font guards

* fix: Used default bold for TabView

Co-authored-by: Vasko <v.trifonov@gmail.com>
This commit is contained in:
Martin Guillon
2020-04-03 15:40:14 +02:00
committed by GitHub
parent 56f6626891
commit ad9daa825f
12 changed files with 32 additions and 26 deletions

View File

@@ -176,6 +176,7 @@ export class ImageSource implements ImageSourceDefinition {
}
static fromFontIconCodeSync(source: string, font: Font, color: Color): ImageSource {
font = font || Font.default;
const paint = new android.graphics.Paint();
paint.setTypeface(font.getAndroidTypeface());
paint.setAntiAlias(true);

View File

@@ -165,6 +165,7 @@ export class ImageSource implements ImageSourceDefinition {
}
static fromFontIconCodeSync(source: string, font: Font, color: Color): ImageSource {
font = font || Font.default;
let fontSize = layout.toDevicePixels(font.fontSize);
if (!fontSize) {
// TODO: Consider making 36 font size as default for optimal look on TabView and ActionBar