Skip to content

Optimize the loadFontFromList method of SkiaFontCollection. #181439

Description

@caijw

Use case

Reduce the generation of unnecessary FontMgr.
https://github.com/flutter/flutter/blob/main/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/fonts.dart#L200C1-L206C1

  String? _readActualFamilyName(Uint8List bytes) {
    final SkFontMgr tmpFontMgr = canvasKit.FontMgr.FromData(<Uint8List>[bytes])!;
    final String? actualFamily = tmpFontMgr.getFamilyName(0);
    tmpFontMgr.delete();
    return actualFamily;
  }

Proposal

Use SkTypeface to read out the actual name of the font instead of creating a new FontMgr object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: typographyText rendering, possibly libtxtc: proposalA detailed proposal for a change to Fluttere: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.team-webOwned by Web platform team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions