mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-08-06 08:29:35 +08:00
Get glyph path individually
This commit is contained in:
@ -274,14 +274,31 @@ class TextRun {
|
||||
);
|
||||
|
||||
@override
|
||||
toString() => 'TextRun($fontSize:$unicharCount:$styleId)';
|
||||
String toString() => 'TextRun($fontSize:$unicharCount:$styleId)';
|
||||
}
|
||||
|
||||
abstract class Font {
|
||||
static Future<void> initialize() => initFont();
|
||||
static Font? decode(Uint8List bytes) => decodeFont(bytes);
|
||||
static Font? decode(Uint8List bytes) {
|
||||
return decodeFont(bytes);
|
||||
}
|
||||
|
||||
RawPath getPath(int glyphId);
|
||||
void dispose();
|
||||
|
||||
TextShapeResult shape(String text, List<TextRun> runs);
|
||||
|
||||
final HashMap<int, ui.Path> _glyphPaths = HashMap<int, ui.Path>();
|
||||
ui.Path getUiPath(int glyphId) {
|
||||
var glyphPath = _glyphPaths[glyphId];
|
||||
if (glyphPath != null) {
|
||||
return glyphPath;
|
||||
}
|
||||
var path = ui.Path();
|
||||
var rawPath = getPath(glyphId);
|
||||
rawPath.issueCommands(path);
|
||||
rawPath.dispose();
|
||||
_glyphPaths[glyphId] = path;
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user