mirror of
https://github.com/penpot/penpot.git
synced 2025-06-09 13:21:38 +02:00
🎉 Store custom fonts (ttfs) and use them to write texts (wasm) (#6050)
This commit is contained in:
parent
e4c9b736f7
commit
eb6d2fb0eb
14 changed files with 386 additions and 140 deletions
|
@ -3,8 +3,9 @@ use crate::shapes::TextContent;
|
|||
|
||||
pub fn render(render_state: &mut RenderState, text: &TextContent) {
|
||||
let mut offset_y = 0.0;
|
||||
for mut skia_paragraph in text.to_paragraphs(&render_state.font_collection) {
|
||||
for mut skia_paragraph in text.to_paragraphs(&render_state.fonts().font_collection()) {
|
||||
skia_paragraph.layout(text.width());
|
||||
|
||||
let xy = (text.x(), text.y() + offset_y);
|
||||
skia_paragraph.paint(render_state.surfaces.canvas(SurfaceId::Fills), xy);
|
||||
offset_y += skia_paragraph.height();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue