mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Migrate Flutter Web to JS static interop - 9. (flutter/engine#32564)
This commit is contained in:
parent
aa81a6bf83
commit
7bdc84940d
@ -2071,9 +2071,13 @@ extension SkFontFeatureExtension on SkFontFeature {
|
||||
class SkTypeface {}
|
||||
|
||||
@JS('window.flutterCanvasKit.Font')
|
||||
@staticInterop
|
||||
class SkFont {
|
||||
external factory SkFont(SkTypeface typeface);
|
||||
external Uint8List getGlyphIDs(String text);
|
||||
}
|
||||
|
||||
extension SkFontExtension on SkFont {
|
||||
external Uint16List getGlyphIDs(String text);
|
||||
external void getGlyphBounds(
|
||||
List<int> glyphs, SkPaint? paint, Uint8List? output);
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ class FontFallbackData {
|
||||
List<bool>.filled(codeUnits.length, false);
|
||||
final String testString = String.fromCharCodes(codeUnits);
|
||||
for (final SkFont font in fonts) {
|
||||
final Uint8List glyphs = font.getGlyphIDs(testString);
|
||||
final Uint16List glyphs = font.getGlyphIDs(testString);
|
||||
assert(glyphs.length == codeUnitsSupported.length);
|
||||
for (int i = 0; i < glyphs.length; i++) {
|
||||
codeUnitsSupported[i] |= glyphs[i] != 0 || _isControlCode(codeUnits[i]);
|
||||
@ -182,7 +182,7 @@ class FontFallbackData {
|
||||
continue;
|
||||
}
|
||||
for (final SkFont font in fontsForFamily) {
|
||||
final Uint8List glyphs = font.getGlyphIDs(testString);
|
||||
final Uint16List glyphs = font.getGlyphIDs(testString);
|
||||
assert(glyphs.length == codeUnitsSupported.length);
|
||||
for (int i = 0; i < glyphs.length; i++) {
|
||||
final bool codeUnitSupported = glyphs[i] != 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user