Properly pass font weight, stretch, style, to XamlCompositor#1302
Conversation
Update from using simplistic mapping using the font's symbolic traits, which ignored stretch, to getting the weight/stretch/style directly from the font. UILabel-rendered narrow or condensed fonts were previously clipped at the sides because the CoreText-calculated width would be for a narrow font, but UILabel would attempt to render a normal font.
| _isItalic = (mask & UIFontDescriptorTraitItalic) > 0; | ||
| _fontWeight = [font _fontWeight]; | ||
| _fontStretch = [font _fontStretch]; | ||
| _fontStyle = [font _fontStyle]; |
There was a problem hiding this comment.
all of the code you're changing here is gone in the CA refactor, but I suppose this can go in and I'll have to forklift it to our UILabel impl. Seems straightforward enough, but please ping me when this goes in so I can do yet another merge :/
There was a problem hiding this comment.
|
|
| CFTypeID CTFontGetTypeID() { | ||
| static CFTypeID __kCTFontTypeID = _CFRuntimeRegisterClass(&__CTFontClass); | ||
| return __kCTFontTypeID; | ||
| } |
There was a problem hiding this comment.
since we are adding these private apis for the sake of passing them along to xaml, we should make just one function that gets all this information. #WontFix
There was a problem hiding this comment.
Discussed offline - I pursued this route earlier, but exporting a struct through this many layers ended up being a much more ugly change. Leaving as is.
In reply to: 86256084 [](ancestors = 86256084)
| } else { | ||
| textControl->FontStyle = Windows::UI::Text::FontStyle::Normal; | ||
| } | ||
| textControl->FontWeight = Windows::UI::Text::FontWeight{ static_cast<unsigned short>(_fontWeight) }; |
There was a problem hiding this comment.
are these all 1-1 mappings? #ByDesign
There was a problem hiding this comment.
Update from using simplistic mapping using the font's symbolic traits, which ignored stretch,
to getting the weight/stretch/style directly from the font.
UILabel-rendered narrow or condensed fonts were previously clipped at the sides
because the CoreText-calculated width would be for a narrow font, but UILabel would attempt to render a normal font.
This change is