diagramTextRunStyle function
TextStyle
diagramTextRunStyle(
- TextRun run,
- TextRole role,
- DiagramColor foreground, {
- double defaultFontSize = diagramDefaultFontSize,
Implementation
TextStyle diagramTextRunStyle(
TextRun run,
TextRole role,
DiagramColor foreground, {
double defaultFontSize = diagramDefaultFontSize,
}) {
final appearance = run.appearance(role);
return TextStyle(
color: (run.color ?? foreground).toColor(),
fontFamily: run.fontFamily,
fontSize: run.fontSize ?? defaultFontSize,
height: diagramDefaultTextHeight,
fontWeight: appearance.fontWeight == 700
? FontWeight.w700
: FontWeight.w400,
fontStyle: appearance.italic ? FontStyle.italic : FontStyle.normal,
decoration: appearance.underline
? TextDecoration.combine([
TextDecoration.underline,
if (appearance.strikethrough) TextDecoration.lineThrough,
])
: appearance.strikethrough
? TextDecoration.lineThrough
: TextDecoration.none,
fontFeatures: [
for (final feature in appearance.fontFeatures.entries)
FontFeature(feature.key, feature.value),
],
);
}