CommunityToolkit / CommunityToolkit/dotnet

Resizer: variable font files: unable to load valid file names

Open
#1,143 0 comments 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

When you download font from https://fonts.google.com/specimen/Open+Sans
you have the choice to use a "variable" font file.

"variable" font files contains alternative axes. Foe ex:
wdth
wght
This is more practical than to use many static font files to get BOLD, MEDIUM etc ...

Both android 12+ and iOS 11+ support variable font files.

Example of a valid file name:
`OpenSans-Italic-VariableFont_wdth,wght.ttf`

When you add that file to the Fonts folder, resizer crashes.

```
1>Microsoft.Maui.Resizetizer.After.targets(568,17): Error MSB4186 : Invalid static method invocation syntax: "[System.IO.Path]::GetFileName(obj\Debug\net10.0-android\android-x64\resizetizer\f\OpenSans-VariableFont_wdth,wght.ttf)". Method 'System.IO.Path.GetFileName' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). Check that all parameters are defined, are of the correct type, and are specified in the right order.
```

When you rename the file, resizer continues to crash. Until your clean and rebuild.

### Regression

_No response_

### Steps to reproduce

You can download the font "OpenSans" on google font.
Both android 12+ and iOS 11+ support variable font files.

```
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-VariableFont_wdth,wght.ttf", "OpenSans");
});
``

### Expected behavior

don't crash :)

### Screenshots

_No response_

### IDE and version

Rider

### IDE version

2025.3.0.1

### Nuget packages

- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [ ] CommunityToolkit.Mvvm (aka MVVM Toolkit)

### Nuget package version(s)

10.0.10

### Additional context

- OS: Window 11
- Target: maui android 10
- VS 2026

### Help us help you

No, just wanted to report this

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.