Background
The Support-multiple-fonts-and-modernize branch contains both infrastructure/migration work and new user-facing features. This issue tracks cherry-picking the features only — no project format, build, or CI changes.
Reference branch: Support-multiple-fonts-and-modernize
This issue is assigned to an AI coding agent. Every step below is meant to be executed directly — no design decisions left open.
Files to touch
| File |
Action |
Text.cs |
Add parameters to FromStringOriginAndScale, add GetInstalledFontNames() |
No other files. Do not touch .csproj, packages.config, CI, or any build infrastructure.
Checklist
1. Extend FromStringOriginAndScale with font, bold, and italic parameters
Current signature:
public static IEnumerable<Curve> FromStringOriginAndScale(string text, Point origin, double scale)
New signature:
public static IEnumerable<Curve> FromStringOriginAndScale(
string text,
Point origin,
double scale,
string fontFamily = "Arial",
bool bold = false,
bool italic = false)
Implementation requirements:
- Validate that
fontFamily exists in Fonts.SystemFontFamilies. If not found, throw ArgumentException with a message that references GetInstalledFontNames() so the user knows how to discover valid values.
- Apply font weight:
bold ? FontWeights.Bold : FontWeights.Medium
- Apply font style:
italic ? FontStyles.Italic : FontStyles.Normal
- Default behavior (
fontFamily = "Arial", bold = false, italic = false) must be identical to the current method — this is a non-breaking change.
2. Add GetInstalledFontNames() utility method
public static IList<string> GetInstalledFontNames()
- Query
Fonts.SystemFontFamilies, extract the .Source property from each family.
- Return as an alphabetically sorted
IList<string> (case-insensitive sort).
- No parameters. Windows-only (same as the rest of the library).
3. Add required using statements if missing
using System; (for ArgumentException)
using System.Linq; (for LINQ queries on SystemFontFamilies)
Definition of done
Notes
Background
The
Support-multiple-fonts-and-modernizebranch contains both infrastructure/migration work and new user-facing features. This issue tracks cherry-picking the features only — no project format, build, or CI changes.Reference branch:
Support-multiple-fonts-and-modernizeThis issue is assigned to an AI coding agent. Every step below is meant to be executed directly — no design decisions left open.
Files to touch
Text.csFromStringOriginAndScale, addGetInstalledFontNames()No other files. Do not touch
.csproj,packages.config, CI, or any build infrastructure.Checklist
1. Extend
FromStringOriginAndScalewith font, bold, and italic parametersCurrent signature:
New signature:
Implementation requirements:
fontFamilyexists inFonts.SystemFontFamilies. If not found, throwArgumentExceptionwith a message that referencesGetInstalledFontNames()so the user knows how to discover valid values.bold ? FontWeights.Bold : FontWeights.Mediumitalic ? FontStyles.Italic : FontStyles.NormalfontFamily = "Arial",bold = false,italic = false) must be identical to the current method — this is a non-breaking change.2. Add
GetInstalledFontNames()utility methodFonts.SystemFontFamilies, extract the.Sourceproperty from each family.IList<string>(case-insensitive sort).3. Add required
usingstatements if missingusing System;(forArgumentException)using System.Linq;(for LINQ queries onSystemFontFamilies)Definition of done
FromStringOriginAndScaleacceptsfontFamily,bold, anditalic— all optional with defaultsFromStringOriginAndScalewith no new arguments produces identical output to current behaviorArgumentExceptionwith message referencingGetInstalledFontNames()GetInstalledFontNames()returns a non-empty, alphabetically sorted list on Windows.csproj, CI, NuGet, or build file changes in this PRNotes
Text.csonly.net45build. If Migrate DynamoText from .NET Framework 4.5 to .NET 8 #10 lands first, targetnet8.0-windows— the feature code is identical either way.