Ocrvs 11552#12334
Draft
kaykobadhossain wants to merge 3 commits intoopencrvs:developfrom
Draft
Conversation
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.
Description
This PR improves SVG font rendering by enhancing how @font-face rules are injected and how font variants (normal, bold, italic, and bold-italic) are handled.
Previously, SVG text styling did not reliably apply bold or italic fonts because font variants were not consistently mapped or matched against SVG font-weight and font-style attributes.
Changes made:
Improved addFontsToSvg function to generate more accurate @font-face rules per font variant.
Added proper mapping for font weight and style based on variant names (e.g. “Bold”, “Italic”).
Ensured SVG elements can correctly resolve font variants using font-weight and font-style.
Root cause:
Font variants were not being correctly matched between SVG attributes and @font-face declarations, leading to incorrect fallback fonts or missing bold/italic rendering.
Fix:
By explicitly defining font-weight and font-style in both the SVG and generated @font-face rules, the browser can now correctly resolve and apply the intended font variants.
Checklist