Name a monospace font list instead of the generic monospace

The generic name only resolves through fontconfig, so on Windows the
windows fell back to the proportional default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 01:07:47 +00:00
co-authored by Claude Sonnet 5.5
parent ae37e0be53
commit 29d3a0f016
18 changed files with 55 additions and 29 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:theming="using:Nonemm.App.Theming"
x:Class="Nonemm.App.Dialogs.MessagesDialog"
Title="Function key messages" Width="620" Height="520"
WindowStartupLocation="CenterOwner" KeyDown="OnKeyDown">
@@ -31,7 +32,7 @@
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Grid>
<StackPanel Name="Highlight" Margin="6,4" IsHitTestVisible="False" ZIndex="1" />
<TextBox Name="TextArea" AcceptsReturn="True" AcceptsTab="False" FontFamily="monospace"
<TextBox Name="TextArea" AcceptsReturn="True" AcceptsTab="False" FontFamily="{x:Static theming:Fonts.Mono}"
FontSize="12" Padding="6,4" TextWrapping="NoWrap" BorderThickness="0"
Background="Transparent" Foreground="Transparent"
VerticalContentAlignment="Top" />
+12
View File
@@ -0,0 +1,12 @@
using Avalonia.Media;
namespace Nonemm.App.Theming;
public static class Fonts
{
/// The generic name `monospace` only resolves through fontconfig, so on
/// Windows it falls back to the proportional default. Each family listed is
/// tried in order.
public static readonly FontFamily Mono = new(
"Cascadia Mono, Consolas, DejaVu Sans Mono, Liberation Mono, Courier New, monospace");
}
@@ -1,3 +1,4 @@
using Nonemm.App.Theming;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Layout;
@@ -85,7 +86,7 @@ public sealed partial class AvailableWindow : RefreshableWindow
TextBlock text = new()
{
Text = Label(station),
FontFamily = new FontFamily("monospace"),
FontFamily = Fonts.Mono,
FontSize = 13,
Foreground = Verdicts.Colour(station.Verdict),
HorizontalAlignment = HorizontalAlignment.Left,
+2 -1
View File
@@ -1,3 +1,4 @@
using Nonemm.App.Theming;
using System.Globalization;
using Avalonia;
using Avalonia.Controls;
@@ -37,7 +38,7 @@ public sealed class BandmapView : Control
/// Past the band edge. The slice can reach there when the radio does.
private static readonly IBrush OutsideBrush = new SolidColorBrush(Color.FromRgb(0xC0, 0x39, 0x2B), 0.13);
private readonly Typeface typeface = new(new FontFamily("monospace"));
private readonly Typeface typeface = new(Fonts.Mono);
private IReadOnlyList<BandmapLabel> placed = [];
private BandmapScale scale = new(Bands.Band20M.Low, Bands.Band20M.High, 1);
@@ -1,3 +1,4 @@
using Nonemm.App.Theming;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
@@ -45,7 +46,7 @@ public sealed partial class CallStackWindow : RefreshableWindow
TextBlock text = new()
{
Text = call,
FontFamily = new FontFamily("monospace"),
FontFamily = Fonts.Mono,
FontSize = 14,
Foreground = Verdicts.Colour(position.JudgeCall(call)),
};
+2 -1
View File
@@ -1,3 +1,4 @@
using Nonemm.App.Theming;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
@@ -57,7 +58,7 @@ public sealed partial class CheckWindow : RefreshableWindow
panel.Children.Add(new TextBlock
{
Text = candidate.Text,
FontFamily = new FontFamily("monospace"),
FontFamily = Fonts.Mono,
FontSize = 14,
Foreground = Verdicts.Colour(candidate.Verdict),
HorizontalAlignment = HorizontalAlignment.Left,
+1 -1
View File
@@ -61,7 +61,7 @@ public sealed partial class DigitalWindow
TextBlock text = new()
{
Text = call,
FontFamily = new FontFamily("monospace"),
FontFamily = Fonts.Mono,
FontSize = Settings.DigitalFontSize,
Foreground = Verdicts.Colour(position.JudgeCall(call)),
};
+3 -2
View File
@@ -1,6 +1,7 @@
<local:RefreshableWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Nonemm.App.Windows"
xmlns:theming="using:Nonemm.App.Theming"
xmlns:controls="using:Nonemm.App.Controls"
x:Class="Nonemm.App.Windows.DigitalWindow"
Title="Digital Interface" Width="900" Height="640">
@@ -29,7 +30,7 @@
<Setter Property="Margin" Value="6,0,4,0" />
</Style>
<Style Selector="TextBlock.readout">
<Setter Property="FontFamily" Value="monospace" />
<Setter Property="FontFamily" Value="{x:Static theming:Fonts.Mono}" />
<Setter Property="FontSize" Value="12" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="4,2" />
@@ -173,7 +174,7 @@
text, so the two wrap together and neither takes width from the
other -->
<controls:TransmitPane Name="TransmitBox" AcceptsReturn="True" TextWrapping="Wrap"
FontFamily="monospace"
FontFamily="{x:Static theming:Fonts.Mono}"
KeyDown="OnTransmitKeyDown"
TextChanged="OnTransmitTextChanged" />
</Border>
@@ -437,7 +437,7 @@ public sealed partial class DigitalWindow : RefreshableWindow
private TextBlock NewBlock(string text) => new()
{
Text = text,
FontFamily = new FontFamily("monospace"),
FontFamily = Fonts.Mono,
FontSize = Settings.DigitalFontSize,
};
+6 -5
View File
@@ -1,5 +1,6 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:theming="using:Nonemm.App.Theming"
x:Class="Nonemm.App.Windows.EntryWindow"
Title="Nonemm"
Width="820" SizeToContent="Height"
@@ -12,7 +13,7 @@
<Setter Property="Margin" Value="2,0,0,1" />
</Style>
<Style Selector="TextBox.entry">
<Setter Property="FontFamily" Value="monospace" />
<Setter Property="FontFamily" Value="{x:Static theming:Fonts.Mono}" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Padding" Value="6,2" />
<Setter Property="VerticalContentAlignment" Value="Center" />
@@ -165,8 +166,8 @@
<StackPanel Margin="6">
<Grid ColumnDefinitions="Auto,Auto,Auto,*,Auto" Margin="0,0,0,6">
<TextBlock Name="FrequencyText" FontFamily="monospace" FontSize="20" Text="14025.00" />
<TextBlock Grid.Column="1" Name="ModeText" FontFamily="monospace" FontSize="20"
<TextBlock Name="FrequencyText" FontFamily="{x:Static theming:Fonts.Mono}" FontSize="20" Text="14025.00" />
<TextBlock Grid.Column="1" Name="ModeText" FontFamily="{x:Static theming:Fonts.Mono}" FontSize="20"
Margin="10,0,0,0" Text="CW" />
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="4" Margin="10,2,0,2"
VerticalAlignment="Center">
@@ -180,11 +181,11 @@
<TextBlock Grid.Column="3" Name="ContestText" FontSize="12" Opacity="0.75"
VerticalAlignment="Center" Margin="12,0,12,0" Text="no contest"
TextTrimming="CharacterEllipsis" ClipToBounds="True" />
<TextBlock Grid.Column="4" Name="ClockText" FontFamily="monospace" FontSize="20"
<TextBlock Grid.Column="4" Name="ClockText" FontFamily="{x:Static theming:Fonts.Mono}" FontSize="20"
Text="00:00:00Z" />
</Grid>
<TextBlock Name="CallFrameText" FontFamily="monospace" FontSize="13" Height="18"
<TextBlock Name="CallFrameText" FontFamily="{x:Static theming:Fonts.Mono}" FontSize="13" Height="18"
Margin="2,0,0,1" Text="" />
<Grid Name="EntryGrid" ColumnDefinitions="Auto" RowDefinitions="Auto,Auto" />
+2 -1
View File
@@ -1,3 +1,4 @@
using Nonemm.App.Theming;
using System.Globalization;
using Avalonia;
using Avalonia.Controls;
@@ -26,7 +27,7 @@ public sealed class GraylineView : Control
private static readonly IBrush Graticule = new SolidColorBrush(Colors.White, 0.15);
private static readonly IBrush Sun = new SolidColorBrush(Color.FromRgb(0xFF, 0xD7, 0x00));
private readonly Typeface typeface = new(new FontFamily("monospace"));
private readonly Typeface typeface = new(Fonts.Mono);
/// The moment the map is drawn for, which is now unless the operator has
/// stepped it forward to see where the grey line will be.
+5 -4
View File
@@ -1,6 +1,7 @@
<local:RefreshableWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Nonemm.App.Windows"
xmlns:theming="using:Nonemm.App.Theming"
x:Class="Nonemm.App.Windows.LogWindow"
Title="Log" Width="1000" Height="420">
<DockPanel>
@@ -10,7 +11,7 @@
<!-- the DataGrid's own font settings do not reach the cells, and the
columns are sized from the width of the text in this font -->
<Style Selector="DataGridCell TextBlock">
<Setter Property="FontFamily" Value="monospace" />
<Setter Property="FontFamily" Value="{x:Static theming:Fonts.Mono}" />
<Setter Property="FontSize" Value="12" />
<!-- half of what the theme leaves either side of the text, so more
columns fit across the window -->
@@ -43,7 +44,7 @@
padding is what the cell gives its text, so the text does not move
sideways as the box opens -->
<Style Selector="DataGridCell TextBox">
<Setter Property="FontFamily" Value="monospace" />
<Setter Property="FontFamily" Value="{x:Static theming:Fonts.Mono}" />
<Setter Property="FontSize" Value="12" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="Margin" Value="0" />
@@ -53,11 +54,11 @@
</Style>
</Grid.Styles>
<DataGrid Name="Rows" Grid.Row="0" GridLinesVisibility="Horizontal" CanUserSortColumns="True"
CanUserReorderColumns="True" FontSize="12" FontFamily="monospace" />
CanUserReorderColumns="True" FontSize="12" FontFamily="{x:Static theming:Fonts.Mono}" />
<GridSplitter Grid.Row="1" Height="3" ResizeDirection="Rows" />
<DataGrid Name="Earlier" Grid.Row="2" IsReadOnly="True" GridLinesVisibility="Horizontal"
CanUserSortColumns="False" HeadersVisibility="None"
FontSize="12" FontFamily="monospace" />
FontSize="12" FontFamily="{x:Static theming:Fonts.Mono}" />
</Grid>
</DockPanel>
</local:RefreshableWindow>
@@ -1,6 +1,7 @@
<local:RefreshableWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Nonemm.App.Windows"
xmlns:theming="using:Nonemm.App.Theming"
x:Class="Nonemm.App.Windows.NetworkStatusWindow"
Title="Network Status" Width="1000" Height="380">
<DockPanel>
@@ -10,12 +11,12 @@
<TabItem Header="Stations" Name="StationsTab">
<DataGrid Name="Rows" IsReadOnly="True" GridLinesVisibility="Horizontal"
CanUserSortColumns="False" FontSize="12" FontFamily="monospace"
CanUserSortColumns="False" FontSize="12" FontFamily="{x:Static theming:Fonts.Mono}"
AutoGenerateColumns="False" x:DataType="local:StationRow">
<DataGrid.Styles>
<!-- the grid's own font settings do not reach the cells -->
<Style Selector="DataGridCell TextBlock">
<Setter Property="FontFamily" Value="monospace" />
<Setter Property="FontFamily" Value="{x:Static theming:Fonts.Mono}" />
<Setter Property="FontSize" Value="12" />
</Style>
</DataGrid.Styles>
@@ -72,7 +73,7 @@
</StackPanel>
</StackPanel>
<DataGrid Name="ResyncRows" IsReadOnly="True" GridLinesVisibility="Horizontal"
CanUserSortColumns="False" FontSize="12" FontFamily="monospace"
CanUserSortColumns="False" FontSize="12" FontFamily="{x:Static theming:Fonts.Mono}"
AutoGenerateColumns="False" x:DataType="local:StationRow">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding Computer}" />
@@ -156,7 +157,7 @@
<Button Content="Clear Messages" Click="OnClearMessages" />
</StackPanel>
<ScrollViewer Name="MessageScroll">
<TextBlock Name="MessageText" FontFamily="monospace" FontSize="11" TextWrapping="Wrap" />
<TextBlock Name="MessageText" FontFamily="{x:Static theming:Fonts.Mono}" FontSize="11" TextWrapping="Wrap" />
</ScrollViewer>
</DockPanel>
</TabItem>
+1 -1
View File
@@ -225,7 +225,7 @@ public sealed partial class QtcWindow : Window
{
TextBox box = new()
{
FontFamily = new FontFamily("monospace"),
FontFamily = Fonts.Mono,
Margin = new Avalonia.Thickness(2, 1, 2, 1),
IsReadOnly = isSending,
};
+2 -1
View File
@@ -1,3 +1,4 @@
using Nonemm.App.Theming;
using Avalonia.Controls;
using Nonemm.Contests;
using Nonemm.Core;
@@ -109,7 +110,7 @@ public sealed partial class ScoreWindow : RefreshableWindow
TextBlock text = new()
{
Text = cells[column],
FontFamily = new Avalonia.Media.FontFamily("monospace"),
FontFamily = Fonts.Mono,
FontSize = 13,
Opacity = header ? 1.0 : 0.85,
Margin = new Avalonia.Thickness(0, 2, 8, 2),
+2 -1
View File
@@ -1,3 +1,4 @@
using Nonemm.App.Theming;
using System.Globalization;
using Avalonia;
using Avalonia.Controls;
@@ -23,7 +24,7 @@ public sealed class StatisticsChart : Control
/// the gap would take more room than the column.
private const double NarrowColumn = 4;
private readonly Typeface typeface = new(new FontFamily("monospace"));
private readonly Typeface typeface = new(Fonts.Mono);
public IReadOnlyList<ChartColumn> Columns { get; set; } = [];
@@ -1,6 +1,7 @@
<local:RefreshableWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Nonemm.App.Windows"
xmlns:theming="using:Nonemm.App.Theming"
x:Class="Nonemm.App.Windows.StatisticsWindow"
Title="Statistics" Width="940" Height="560">
<DockPanel>
@@ -33,12 +34,12 @@
<Grid.Styles>
<!-- the DataGrid's own font settings do not reach the cells -->
<Style Selector="DataGridCell TextBlock">
<Setter Property="FontFamily" Value="monospace" />
<Setter Property="FontFamily" Value="{x:Static theming:Fonts.Mono}" />
<Setter Property="FontSize" Value="12" />
</Style>
</Grid.Styles>
<DataGrid Name="Table" IsReadOnly="True" CanUserSortColumns="False"
GridLinesVisibility="All" FontFamily="monospace" FontSize="12" />
GridLinesVisibility="All" FontFamily="{x:Static theming:Fonts.Mono}" FontSize="12" />
<TextBlock Name="EmptyText" Margin="12" IsVisible="False" />
</Grid>
</TabItem>
+2 -1
View File
@@ -1,6 +1,7 @@
<local:RefreshableWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Nonemm.App.Windows"
xmlns:theming="using:Nonemm.App.Theming"
x:Class="Nonemm.App.Windows.TelnetWindow"
Title="Telnet" Width="760" Height="520">
<Window.Styles>
@@ -32,7 +33,7 @@
<TextBox Name="CommandBox" PlaceholderText="command to the node" KeyDown="OnCommandKey" />
</DockPanel>
</StackPanel>
<ListBox Name="Traffic" FontFamily="monospace" FontSize="12" Margin="8,0"
<ListBox Name="Traffic" FontFamily="{x:Static theming:Fonts.Mono}" FontSize="12" Margin="8,0"
DoubleTapped="OnJumpToSpot">
<ListBox.ContextMenu>
<ContextMenu>