Support font-style: oblique <angle> - #206
Merged
TylerBrinks merged 1 commit intoJul 23, 2026
Merged
Conversation
font-style accepts an optional angle after oblique (CSS Fonts 4 2.4), e.g. "oblique 14deg". FontStyleConverter only accepted the plain keywords, so any oblique-with-angle value was rejected. Compose the keyword map with a StartsWithValueConverter that matches "oblique" followed by an <angle>. It is deliberately not Option()-wrapped around the angle: StartsWithValueConverter treats a non-null wrapped result as "matched", and an Option() converter never returns null, which would make every other font-style value reconstruct as "oblique" when the font shorthand is re-serialized from its longhands. Includes the StartsWithValueConverter empty-input fix (also submitted standalone as the "Return null from StartsWithValueConverter on empty input" PR): reconstructing an omitted font-style longhand runs this converter on empty input, which previously threw. If that PR merges first, this rebases cleanly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature
font-styleaccepts an optional angle afteroblique(CSS Fonts 4 §2.4):FontStyleConverteraccepted only the plain keywords (normal/italic/oblique), so anyoblique <angle>was rejected.Implementation
Compose the keyword map with a
StartsWithValueConvertermatchingobliquefollowed by an<angle>.The angle is deliberately not
Option()-wrapped:StartsWithValueConvertertreats a non-null wrapped result as "matched", and anOption()converter never returns null — so every otherfont-stylevalue (plain keywords, absent) would then falsely reconstruct asobliquewhen thefontshorthand is re-serialized from its longhands. A regression test pins this.Dependency
Reconstructing an omitted
font-stylelonghand (e.g. fromfont: bold 12px serif) runs this converter on empty input, which throws aNullReferenceExceptiononmaster. This branch includes the one-line fix for that, also submitted standalone as "Return null from StartsWithValueConverter on empty input" (#196). If that merges first, this rebases cleanly; if not, it's self-contained.Tests
oblique <angle>values (deg, negative, zero,grad)oblique 14px,italic 14deg, bare14deg)font: bold 12px serifre-serializes without throwing and without a spuriousobliqueThe full suite (1263 existing tests) stays green, and all seven target frameworks build with no new warnings.