Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@nturgut
Copy link
Contributor

@nturgut nturgut commented Oct 4, 2019

do not wrap font family name in webkit otherwise icons not show on safari 13 (both IOS and desktop)

Manually tested using Flutter Gallery app and other additions:

  • Iphone with safari 12
  • Iphone with safari 13
  • Desktop with safari 13
  • Firefox Desktop
  • Chrome Desktop
  • Chrome on Android

Additional fonts/icons tested:
"MdiIcons" (package:material_design_icons_flutter/material_design_icons_flutter.dart)
"Lucida" Grande

Fixes the issue: flutter/flutter#41218
Fixes the issue: flutter/flutter#41483

@nturgut nturgut added the platform-web Code specifically for the web engine label Oct 4, 2019
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

LGTM if LGT @hterkelsen

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

LGTM if LGT @hterkelsen

final String familyNameInQuotes = "'$family'";
// Regular expression to detect punctuations. For example font family
// 'Ahem!' falls into this category.
final RegExp punctuations = RegExp(r"[.,:;!`\/#\$\%\^&~\*=\-_(){}]");
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of listing all the possible punctuation symbols, is it possible to use something like this: RegExp(r"[^a-z0-9 ]", caseSensitive: false)? Which matches anything other than an alphabet or digit or whitespace.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should just try to match the whole family name with a regex for CSS identifiers: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident

so something like

RegExp(r"[a-zA-Z][a-zA-Z0-9\-_]*")

Copy link
Contributor Author

@nturgut nturgut Oct 10, 2019

Choose a reason for hiding this comment

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

@hterkelsen
I think using one regex for all the matches will create maintance/readibility issues. The correct regex for a valid family is very long and hard to understand in the first look.

If we use:
static final RegExp cssIdentifiers = RegExp(r"[a-zA-Z][a-zA-Z0-9\-_]*");

This does not cover valid cases such as:

  • Gill Sans Extrabold
  • ahem ahem

If we add the whitespace and use:

static final RegExp cssIdentifiers = RegExp(r"[a-zA-Z][a-zA-Z0-9\-_\s]*");
this also does not recognize invalid cases such as:

  • Ahem 1989
  • Goudy Bookletter 1911

We can also add the digit starting token case using \b\d yet this will make the regex even longer.

Please let me know if you have a suggestion for simpler regex? Otherwise use 2 regex one @mdebbar 's other is the digit check:

static final RegExp notPunctuation = RegExp(r"[^a-z0-9\s]", caseSensitive: false);
static final RegExp startWithDigit = RegExp(r"\b\d");

Note (the documentation):
"Font family names must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means that punctuation characters and digits at the start of each token must be escaped in unquoted font family names."

Copy link
Contributor

Choose a reason for hiding this comment

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

You could do:

static final RegExp cssIdentifiers = RegExp(r"[a-zA-Z][a-zA-Z0-9\-_]*(\s[a-zA-Z][a-zA-Z0-9\-_]*)+");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check the new version :)

I believe it is very readable. It has two parts but each of them are very small.

Thanks for the review!

final String familyNameInQuotes = "'$family'";
// Regular expression to detect punctuations. For example font family
// 'Ahem!' falls into this category.
final RegExp punctuations = RegExp(r"[.,:;!`\/#\$\%\^&~\*=\-_(){}]");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should just try to match the whole family name with a regex for CSS identifiers: https://developer.mozilla.org/en-US/docs/Web/CSS/custom-ident

so something like

RegExp(r"[a-zA-Z][a-zA-Z0-9\-_]*")

@nturgut
Copy link
Contributor Author

nturgut commented Oct 10, 2019

I'll send one more commit. Thanks for all the comments.

@nturgut nturgut merged commit 3ad8c42 into flutter:master Oct 11, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 14, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Oct 15, 2019
git@github.com:flutter/engine.git/compare/eed171ff3538...66bf00b

git log eed171f..66bf00b --no-merges --oneline
2019-10-14 50856934+nturgut@users.noreply.github.com refactoring chrome_installer (flutter/engine#13122)
2019-10-14 mklim@google.com Fire PlatformViewController FlutterView callbacks (flutter/engine#13015)
2019-10-14 30870216+gaaclarke@users.noreply.github.com iOS Platform View: Fixed overrelease of the observer. (flutter/engine#13093)
2019-10-14 ferhat@gmail.com [web] Add basic color per vertex drawVertices API support (flutter/engine#13066)
2019-10-14 mouad.debbar@gmail.com Support keyboard types on mobile browsers (flutter/engine#13044)
2019-10-14 liyuqian@google.com Change IO thread shader cache strategy (flutter/engine#13121)
2019-10-14 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from _GTls... to xRgq0... (flutter/engine#13115)
2019-10-14 skia-flutter-autoroll@skia.org Roll src/third_party/skia 3838fe3c82b4..a7e1b45d9c28 (1 commits) (flutter/engine#13117)
2019-10-14 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from E3s7G... to Lk7iT... (flutter/engine#13116)
2019-10-14 bkonyi@google.com Roll src/third_party/dart 5fad012d02..892fcf2c45 (15 commits)
2019-10-14 jason-simmons@users.noreply.github.com Integrate more SkParagraph builder patches (flutter/engine#13094)
2019-10-13 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from T3Xkz... to E3s7G... (flutter/engine#13114)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from lJPDX... to _GTls... (flutter/engine#13113)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from W9PBe... to T3Xkz... (flutter/engine#13112)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/clang/linux-amd64 from q4DVY... to 2EAvs... (flutter/engine#13111)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/clang/mac-amd64 from zpVtV... to xTJWs... (flutter/engine#13110)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from LsxeL... to lJPDX... (flutter/engine#13109)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from ShVbh... to W9PBe... (flutter/engine#13108)
2019-10-12 bkonyi@google.com Roll src/third_party/dart 90ff37e011..5fad012d02 (6 commits)
2019-10-12 bkonyi@google.com Roll src/third_party/dart 42dcdf903c..90ff37e011 (7 commits)
2019-10-12 skia-flutter-autoroll@skia.org Roll src/third_party/skia 8c6c8b0c42e2..3838fe3c82b4 (3 commits) (flutter/engine#13105)
2019-10-12 liyuqian@google.com Analyze framework Dart code in presubmit tests (flutter/engine#13037)
2019-10-12 iska.kaushik@gmail.com [dart_aot_runner] Complete the port of dart_aot_runner (flutter/engine#13103)
2019-10-11 matthew-carroll@users.noreply.github.com Move initialization into FlutterEngine (flutter/engine#12806)
2019-10-11 ferhat@gmail.com Update felt README (flutter/engine#13097)
2019-10-11 bkonyi@google.com Roll src/third_party/dart 9f33e8da04..42dcdf903c (7 commits)
2019-10-11 iska.kaushik@gmail.com [dart_aot_runner] Generate vmservice aotsnapshots (flutter/engine#13101)
2019-10-11 dnfield@google.com ColorFilter matrix docs (flutter/engine#13100)
2019-10-11 dnfield@google.com cleanup gen_package.py (flutter/engine#13089)
2019-10-11 iska.kaushik@gmail.com [dart_aot_runner] Use the host_toolchain to build kernels (flutter/engine#13096)
2019-10-11 50856934+nturgut@users.noreply.github.com do not wrap font family name (flutter/engine#12801)
2019-10-11 skia-flutter-autoroll@skia.org Roll src/third_party/skia df640e6d14a5..8c6c8b0c42e2 (12 commits) (flutter/engine#13098)
2019-10-11 liyuqian@google.com Remove persistent cache unittest timeout (flutter/engine#13091)
2019-10-11 matthew-carroll@users.noreply.github.com Added FlutterActivity and FlutterFragment hook to cleanUpFlutterEngine() as symmetry for configureFlutterEngine(). (#41943) (flutter/engine#12987)
2019-10-11 yjbanov@google.com use rest args for specifying test targets (flutter/engine#13088)
2019-10-11 yjbanov@google.com Snapshot the felt tool for faster start-up (flutter/engine#13090)
2019-10-11 bkonyi@google.com Roll src/third_party/dart 965b8cb1d8..9f33e8da04 (15 commits)
2019-10-11 dnfield@google.com java imports/style (flutter/engine#13082)
2019-10-11 30870216+gaaclarke@users.noreply.github.com Removed retain cycle from notification center. (flutter/engine#13073)
2019-10-11 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from U4IBp... to ShVbh... (flutter/engine#13092)
2019-10-11 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from fk6ou... to LsxeL... (flutter/engine#13083)
2019-10-11 skia-flutter-autoroll@skia.org Roll src/third_party/skia 6c2b2bb02402..df640e6d14a5 (1 commits) (flutter/engine#13080)
2019-10-11 dnfield@google.com Gen package output corrected (flutter/engine#13086)
2019-10-11 dnfield@google.com Print more output when gen_package fails (flutter/engine#13085)

...
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
git@github.com:flutter/engine.git/compare/eed171ff3538...66bf00b

git log eed171f..66bf00b --no-merges --oneline
2019-10-14 50856934+nturgut@users.noreply.github.com refactoring chrome_installer (flutter/engine#13122)
2019-10-14 mklim@google.com Fire PlatformViewController FlutterView callbacks (flutter/engine#13015)
2019-10-14 30870216+gaaclarke@users.noreply.github.com iOS Platform View: Fixed overrelease of the observer. (flutter/engine#13093)
2019-10-14 ferhat@gmail.com [web] Add basic color per vertex drawVertices API support (flutter/engine#13066)
2019-10-14 mouad.debbar@gmail.com Support keyboard types on mobile browsers (flutter/engine#13044)
2019-10-14 liyuqian@google.com Change IO thread shader cache strategy (flutter/engine#13121)
2019-10-14 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from _GTls... to xRgq0... (flutter/engine#13115)
2019-10-14 skia-flutter-autoroll@skia.org Roll src/third_party/skia 3838fe3c82b4..a7e1b45d9c28 (1 commits) (flutter/engine#13117)
2019-10-14 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from E3s7G... to Lk7iT... (flutter/engine#13116)
2019-10-14 bkonyi@google.com Roll src/third_party/dart 5fad012d02..892fcf2c45 (15 commits)
2019-10-14 jason-simmons@users.noreply.github.com Integrate more SkParagraph builder patches (flutter/engine#13094)
2019-10-13 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from T3Xkz... to E3s7G... (flutter/engine#13114)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from lJPDX... to _GTls... (flutter/engine#13113)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from W9PBe... to T3Xkz... (flutter/engine#13112)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/clang/linux-amd64 from q4DVY... to 2EAvs... (flutter/engine#13111)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/clang/mac-amd64 from zpVtV... to xTJWs... (flutter/engine#13110)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from LsxeL... to lJPDX... (flutter/engine#13109)
2019-10-12 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from ShVbh... to W9PBe... (flutter/engine#13108)
2019-10-12 bkonyi@google.com Roll src/third_party/dart 90ff37e011..5fad012d02 (6 commits)
2019-10-12 bkonyi@google.com Roll src/third_party/dart 42dcdf903c..90ff37e011 (7 commits)
2019-10-12 skia-flutter-autoroll@skia.org Roll src/third_party/skia 8c6c8b0c42e2..3838fe3c82b4 (3 commits) (flutter/engine#13105)
2019-10-12 liyuqian@google.com Analyze framework Dart code in presubmit tests (flutter/engine#13037)
2019-10-12 iska.kaushik@gmail.com [dart_aot_runner] Complete the port of dart_aot_runner (flutter/engine#13103)
2019-10-11 matthew-carroll@users.noreply.github.com Move initialization into FlutterEngine (flutter/engine#12806)
2019-10-11 ferhat@gmail.com Update felt README (flutter/engine#13097)
2019-10-11 bkonyi@google.com Roll src/third_party/dart 9f33e8da04..42dcdf903c (7 commits)
2019-10-11 iska.kaushik@gmail.com [dart_aot_runner] Generate vmservice aotsnapshots (flutter/engine#13101)
2019-10-11 dnfield@google.com ColorFilter matrix docs (flutter/engine#13100)
2019-10-11 dnfield@google.com cleanup gen_package.py (flutter/engine#13089)
2019-10-11 iska.kaushik@gmail.com [dart_aot_runner] Use the host_toolchain to build kernels (flutter/engine#13096)
2019-10-11 50856934+nturgut@users.noreply.github.com do not wrap font family name (flutter/engine#12801)
2019-10-11 skia-flutter-autoroll@skia.org Roll src/third_party/skia df640e6d14a5..8c6c8b0c42e2 (12 commits) (flutter/engine#13098)
2019-10-11 liyuqian@google.com Remove persistent cache unittest timeout (flutter/engine#13091)
2019-10-11 matthew-carroll@users.noreply.github.com Added FlutterActivity and FlutterFragment hook to cleanUpFlutterEngine() as symmetry for configureFlutterEngine(). (flutter#41943) (flutter/engine#12987)
2019-10-11 yjbanov@google.com use rest args for specifying test targets (flutter/engine#13088)
2019-10-11 yjbanov@google.com Snapshot the felt tool for faster start-up (flutter/engine#13090)
2019-10-11 bkonyi@google.com Roll src/third_party/dart 965b8cb1d8..9f33e8da04 (15 commits)
2019-10-11 dnfield@google.com java imports/style (flutter/engine#13082)
2019-10-11 30870216+gaaclarke@users.noreply.github.com Removed retain cycle from notification center. (flutter/engine#13073)
2019-10-11 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/mac-amd64 from U4IBp... to ShVbh... (flutter/engine#13092)
2019-10-11 skia-flutter-autoroll@skia.org Roll fuchsia/sdk/core/linux-amd64 from fk6ou... to LsxeL... (flutter/engine#13083)
2019-10-11 skia-flutter-autoroll@skia.org Roll src/third_party/skia 6c2b2bb02402..df640e6d14a5 (1 commits) (flutter/engine#13080)
2019-10-11 dnfield@google.com Gen package output corrected (flutter/engine#13086)
2019-10-11 dnfield@google.com Print more output when gen_package fails (flutter/engine#13085)

...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants