Skip to content

Commit

Permalink
Replaced font shorthand property with expanded properties (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmester committed Oct 3, 2023
1 parent 2a85a2a commit ca68c19
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/PdfToSvg/Drawing/SvgRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2155,19 +2155,11 @@ private static List<TextParagraph> PrepareSvgSpans(List<TextParagraph> paragraph
throw new PdfException("Unexpected font type.");
}

// Use shorthand font property if possible
if (fontSize != null && fontFamily != null)
{
var values = new[] { fontStyle, fontWeight, fontSize, fontFamily };
cssClass["font"] = string.Join(" ", values.Where(v => v != null));
}
else
{
cssClass["font-family"] = fontFamily;
cssClass["font-weight"] = fontWeight;
cssClass["font-style"] = fontStyle;
cssClass["font-size"] = fontSize;
}
// Shorthand font property not used since it does not seem to be supported by Microsoft Office apps
cssClass["font-family"] = fontFamily;
cssClass["font-weight"] = fontWeight;
cssClass["font-style"] = fontStyle;
cssClass["font-size"] = fontSize;

if (style.Font.HasGlyphSubstitutions)
{
Expand Down

0 comments on commit ca68c19

Please sign in to comment.