microsoft / microsoft/WPF-Samples

HtmlFromXamlConverter.cs doesn't set units on CSS font-size attribute

Open
#46 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
5.7k
Forks
3.3k
Avg merge
12d 8h
Merged PRs (30d)
2

Description

For all I know setting the units on a CSS font-size attribute is mandatory. I updated line 162 to the following in order to make it specify the font-size in points:

css = "font-size:" 
    + Math.Round(double.Parse(xamlReader.Value, CultureInfo.InvariantCulture) / (96.0 / 72.0), 2)
      .ToString("0.##", CultureInfo.InvariantCulture) + "pt;";

This only works for when the FontSize in the XAML is specified in points and without units (as it's generated by XamlWriter.Save).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading HtmlFromXamlConverter.cs around line 162 and compare the XAML font-size value produced by XamlWriter.Save with the CSS output. Done means generated CSS font-size values include appropriate units, including the point-based values described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.