Skip to content

[vector_graphics_compiler] Ignore unrecognized font-weight values - #12199

Merged
auto-submit[bot] merged 2 commits into
flutter:mainfrom
Yusufihsangorgel:fix/vgc-font-weight-regular
Jul 28, 2026
Merged

[vector_graphics_compiler] Ignore unrecognized font-weight values#12199
auto-submit[bot] merged 2 commits into
flutter:mainfrom
Yusufihsangorgel:fix/vgc-font-weight-regular

Conversation

@Yusufihsangorgel

@Yusufihsangorgel Yusufihsangorgel commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes flutter/flutter#186933

SvgParser.parseFontWeight throws on any value outside the recognized CSS
keywords and numeric weights. That makes the whole SVG fail to compile for
non-standard values such as font-weight="regular".

This change treats an unrecognized value as an invalid declaration: it emits a
warning and returns no parsed value, so normal style inheritance still applies.
An unstyled root therefore keeps the initial normal weight, while an invalid
child declaration no longer overrides a bold parent. Strict
warningsAsErrors builds continue to throw.

Tests cover an unrecognized root value, inheritance from a bold parent, and the
warnings-as-errors path. flutter analyze and the full 333-test
vector_graphics_compiler suite pass locally.

Pre-Review Checklist

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@google-cla

google-cla Bot commented Jul 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added p: vector_graphics triage-engine Should be looked at in engine triage labels Jul 14, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the SVG parser in vector_graphics_compiler to accept the non-standard font-weight 'regular' value as an alias for 'normal'. It also changes the behavior for unrecognized font-weight values to print a warning and fall back to normal weight instead of throwing a StateError, unless warnings are configured as errors. Relevant tests, changelog entries, and version bumps are included. There are no review comments, and I have no feedback to provide.

@stuartmorgan-g
stuartmorgan-g requested a review from jtmcdole July 14, 2026 18:31
@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

For engine team reviewers: I left a comment on the issue; it's not clear to me that adding explicit handling of the non-standard value is actually something we want.

@Yusufihsangorgel
Yusufihsangorgel force-pushed the fix/vgc-font-weight-regular branch from 4f19cc4 to 2583c2e Compare July 14, 2026 19:12
@Yusufihsangorgel Yusufihsangorgel changed the title [vector_graphics_compiler] Support non-standard font-weight="regular" [vector_graphics_compiler] Fall back to normal weight for unrecognized font-weight Jul 14, 2026
@Yusufihsangorgel

Copy link
Copy Markdown
Contributor Author

Agreed — (C) is the right call. An invalid font-weight is dropped at parse time per CSS error handling, so the element just keeps the default (normal); following that is cleaner than special-casing regular. I've updated the PR to remove the explicit alias and keep only the generic fallback: an unrecognized value resolves to normalFontWeight with a warning, and still throws under warningsAsErrors so strict builds are unaffected. That covers the reported VectSharp output as a byproduct of following the spec, without blessing a non-standard keyword.

@Yusufihsangorgel
Yusufihsangorgel force-pushed the fix/vgc-font-weight-regular branch from 2583c2e to 68d7f5f Compare July 14, 2026 19:45
@Yusufihsangorgel Yusufihsangorgel changed the title [vector_graphics_compiler] Fall back to normal weight for unrecognized font-weight [vector_graphics_compiler] Ignore unrecognized font-weight values Jul 15, 2026
@gaaclarke
gaaclarke requested review from andywolff and removed request for jtmcdole July 27, 2026 18:09

@andywolff andywolff left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I agree with @stuartmorgan-g 's comment suggesting option C, thanks for updating to that approach.

@andywolff andywolff added the CICD Run CI/CD label Jul 27, 2026
@andywolff

Copy link
Copy Markdown

I think the CI failure is likely flutter/flutter#190084 and not caused by this PR

@Yusufihsangorgel

Copy link
Copy Markdown
Contributor Author

flutter/flutter#190084 closed this morning. The two failed android_build_all_packages runs predate the fix, so a presubmit re-run should come back green. Happy to rebase to re-trigger if that's easier.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 28, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 28, 2026
@auto-submit

auto-submit Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12199, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@andywolff andywolff added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 28, 2026
@auto-submit
auto-submit Bot merged commit 3d05e51 into flutter:main Jul 28, 2026
14 checks passed
navaronbracke pushed a commit to navaronbracke/flutter that referenced this pull request Jul 29, 2026
…er#190216)

flutter/packages@3e63635...dd11626

2026-07-29 stuartmorgan@google.com [pigeon] Clean up legacy registrant
code (flutter/packages#12205)
2026-07-29 me@davidmiguel.com [go_router] Add
BlockedInitialNavigationException for blocked initial deep links
(flutter/packages#12213)
2026-07-28 stuartmorgan@google.com [file_selector] Switch to Swift
Testing (flutter/packages#12235)
2026-07-28 269567208+reidbaker-agent@users.noreply.github.com Exempt
evals directories from version checks (flutter/packages#12299)
2026-07-28 dkwingsmt@users.noreply.github.com [material_ui,
cupertino_ui] Migrate macros that contain `@tool`
(flutter/packages#12271)
2026-07-28 katelovett@google.com [material_ui, cupertino_ui] Fix API doc
references (flutter/packages#12274)
2026-07-28 43054281+camsim99@users.noreply.github.com
[camera_android_camerax] Delete `GeneratedCameraxLibrary.java`
(flutter/packages#12294)
2026-07-28 engine-flutter-autoroll@skia.org Roll Flutter from
9988960 to 0f02463 (16 revisions) (flutter/packages#12300)
2026-07-28 developeryusuf@icloud.com [vector_graphics_compiler] Ignore
unrecognized font-weight values (flutter/packages#12199)
2026-07-28 stuartmorgan@google.com [tool] Support promoting to 1.0 in
batch releases (flutter/packages#12262)
2026-07-28 1063596+reidbaker@users.noreply.github.com ci: Fix Zizmor
github-env failure in install_flutter action (flutter/packages#12298)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD p: vector_graphics triage-engine Should be looked at in engine triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[vector_graphics_compiler] Support non-standard font-weight="regular" styling

3 participants