Repository navigation
Add Theme Fonts topic (EN + JA) - #759
Conversation
Documents how the RevealTheme font properties resolve on the web: the family-per-style model, a dedicated family per style vs one family for every style derived from the page's @font-face rules, the stylesheet prerequisite, the console warning for missing faces, limitations, and the italicFont/boldItalicFont behavior change. Theming becomes a sidebar category with Fonts as its child; the Theming property table gains the italic slots.
There was a problem hiding this comment.
@TorreyBetts , at first look it looks okay to me.
I passed the doc to my local testing sample asking to verify the content against it, and this is what I got as results:
- "the same value as
regularFont" is a literal string compare — and fails silently.The doc's contract is "when a style property has the same value as
regularFont." That's an exact!==inaliasFor(), applied before_firstFamily()normalizes. So both of these name the same family and neither aliases:theme.regularFont = "Crimson Pro";
theme.boldFont = "'Crimson Pro'"; // quoted
theme.italicFont = "Crimson Pro, serif"; // fallback list
Both render at the 344.23px system-fallback width. Worse — zero warnings. The early return happens before registration, so the slot never enters the set
whenReady()diagnoses. This is the only completely silent failure mode in the feature (missingFacesat least warns four times), and the doc's wording actively invites it. Suggest a caution that the name must match character-for-character, unquoted, with no fallback list.2. "A rule that declares a weight range, as variable fonts do, matches any weight inside the range" is misleading.
The matcher does accept the range — that part is true. But
_renameFamily()rewrites only thefont-familydescriptor, so the alias inheritsfont-weight: 200 900, resolves to 400, and renders regular while reporting injected and usable. Measured, same two font files:
@font-face declaration | medium | bold | italic | bold-italic
-- | -- | -- | -- | --
font-weight: 200 900 (variable) | 337.81 ✗ | 337.81 ✗ | 317.84 ✓ | 317.84 ✓
discrete 400/500/700 | 344.01 ✓ | 359.5 ✓ | 317.84 ✓ | 350.51 ✓
Only the descriptor differs. This matters because the doc recommends self-hosting and the Google Fonts examples only pass by accident — Google serves discrete per-subset weights. Variable fonts are increasingly the default way fonts ship. Either add a caution to declare discrete weights, or fix the alias to pin font-weight/font-style to the requested value.
3. The RevealSdkSettings.theme mutation trap is undocumented.
Every code sample in the PR happens to do it right (new RevealTheme() → assign), but nothing says the assignment is what applies it. Mutating the live theme injects zero aliases:
RevealSdkSettings.theme.boldFont = "Crimson Pro"; // does nothing
Aliases are requested from updateRevealTheme(), whose only caller is the theme setter. The getter returns the live object, so mutation never triggers it. Fonts still appear to load and everything renders regular — indistinguishable from the bug this feature fixes. Worth an explicit wrong/right pair, especially since the neighbouring refreshTheme note may lead readers to assume that's the apply step.
…ing font changes Addresses review feedback on the Theme Fonts topic (EN + JA): - Style properties must be the identical string as regularFont; quoted names and fallback lists do not match and fail without a warning. - Weight-range @font-face rules (variable fonts, Google Fonts range requests) render at weight 400; declare one single-value rule per weight. - Fonts apply on assignment to RevealSdkSettings.theme; mutating the current theme object applies nothing, and refreshTheme is not the apply step.
|
@zdrawku thanks, all three were accurate. I checked each against 1. Exact string compare. Confirmed: 2. Weight ranges. Confirmed and reproduced. Cloning a
3. Theme mutation. Confirmed: the getter returns the live Both locales build cleanly with the new anchors resolving ( |
Closes #758.
Adds a Theme Fonts topic under Theming (Web SDK), in English and Japanese, documenting how the
RevealThemefont properties resolve and how to use them with the font style support added in Infragistics-BusinessTools/Reveal#4009.New topic:
web/theming-fontsregularFont,mediumFont,boldFont,italicFont,boldItalicFont) and examples of where each is used.@font-facerules (weight/style table included).@font-faceprerequisite, with a Google Fonts<link>and a self-hosted example, and a caution to add the stylesheet before assigning the theme.FontFaceconstructor, and the installed-font fallback.italicFontandboldItalicFontwere previously accepted but not applied on the web.Other changes
web/theming-dashboards:italicFontandboldItalicFontadded to the property table, with a pointer to the new topic.sidebars.ts: Theming is now a category with Fonts as its child; Japanese labels added tocurrent.json.jaimage folder.Release notes are not touched here; the
italicFont/boldItalicFontbehavior change is ready to be picked up when the next version's notes are written.