Skip to content

Custom fonts have a weird height #10769

@mohammadrafigh

Description

@mohammadrafigh

Issue Description

When importing a custom font using "fonts" directory and using it, we get an over-height rendered text or icon on Android.

Edit: If it helps, setting nativeElement.nativeViewProtected.setIncludeFontPadding(false); fixes the problem for a specific Label.

Reproduction

  1. Initialize a new project
  2. Put a custom font in src/fonts directory
  3. Add a class which refers to the font: .custom-font { font-family: "my-custom-font"; font-weight: 400; }
  4. Assign the class to a Label.
  5. Run the project and see the over-height text.

Relevant log output (if applicable)

Environment

OS: Linux 6.14 Ubuntu 25.04 25.04 (Plucky Puffin)
CPU: (22) x64 Intel(R) Core(TM) Ultra 7 155H
Shell: /usr/bin/zsh
node: 20.19.3
npm: 10.8.2
nativescript: 8.9.2

# android
java: 17.0.15
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: Not Found
cocoapods: Not Found
python: Not Found
python3: 3.13.3
ruby: Not Found
platforms: Not Found

Dependencies

"dependencies": {
  "@angular/animations": "~20.0.0",
  "@angular/common": "~20.0.0",
  "@angular/compiler": "~20.0.0",
  "@angular/core": "~20.0.0",
  "@angular/forms": "~20.0.0",
  "@angular/platform-browser": "~20.0.0",
  "@angular/platform-browser-dynamic": "~20.0.0",
  "@angular/router": "~20.0.0",
  "@nativescript-community/ui-collectionview": "^6.0.4",
  "@nativescript-community/universal-links": "^3.0.1",
  "@nativescript/angular": "^20.0.0",
  "@nativescript/core": "~8.9.5",
  "@nativescript/localize": "^5.2.0",
  "@nativescript/secure-storage": "^3.0.3",
  "@triniwiz/nativescript-couchbase": "^1.4.0",
  "@triniwiz/nativescript-image-cache-it": "^8.0.0-alpha.1",
  "rxjs": "~7.8.0",
  "zone.js": "~0.15.0"
},
"devDependencies": {
  "@angular-devkit/build-angular": "~20.0.0",
  "@angular/compiler-cli": "~20.0.0",
  "@nativescript/android": "8.9.1",
  "@nativescript/tailwind": "^4.0.3",
  "@nativescript/types": "~8.9.1",
  "@nativescript/webpack": "~5.0.24",
  "@ngtools/webpack": "~20.0.0",
  "tailwindcss": "~4.1.11",
  "typescript": "~5.8.3"
}

Please accept these terms

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions