|
7 | 7 | //! Note: Emoji rendering is not currently implemented in this example. See the swash example
|
8 | 8 | //! if you need emoji rendering.
|
9 | 9 |
|
10 |
| -use std::borrow::Cow; |
11 |
| - |
12 |
| -use parley::layout::{Alignment, GlyphRun, Layout, PositionedLayoutItem}; |
13 |
| -use parley::style::{FontStack, FontWeight, StyleProperty}; |
14 |
| -use parley::{FontContext, InlineBox, LayoutContext}; |
| 10 | +use parley::{ |
| 11 | + Alignment, FontContext, FontWeight, GenericFamily, GlyphRun, InlineBox, Layout, LayoutContext, |
| 12 | + PositionedLayoutItem, StyleProperty, |
| 13 | +}; |
15 | 14 | use peniko::Color as PenikoColor;
|
16 |
| -use skrifa::instance::{LocationRef, NormalizedCoord, Size}; |
17 |
| -use skrifa::outline::{DrawSettings, OutlinePen}; |
18 |
| -use skrifa::raw::FontRef as ReadFontsRef; |
19 |
| -use skrifa::{GlyphId, MetadataProvider, OutlineGlyph}; |
| 15 | +use skrifa::{ |
| 16 | + instance::{LocationRef, NormalizedCoord, Size}, |
| 17 | + outline::{DrawSettings, OutlinePen}, |
| 18 | + raw::FontRef as ReadFontsRef, |
| 19 | + GlyphId, MetadataProvider, OutlineGlyph, |
| 20 | +}; |
20 | 21 | use tiny_skia::{
|
21 | 22 | Color as TinySkiaColor, FillRule, Paint, PathBuilder, Pixmap, PixmapMut, Rect, Transform,
|
22 | 23 | };
|
@@ -52,19 +53,16 @@ fn main() {
|
52 | 53 |
|
53 | 54 | // Set default text colour styles (set foreground text color)
|
54 | 55 | let brush_style = StyleProperty::Brush(foreground_color);
|
55 |
| - builder.push_default(&brush_style); |
| 56 | + builder.push_default(brush_style); |
56 | 57 |
|
57 | 58 | // Set default font family
|
58 |
| - let font_stack = FontStack::Source(Cow::Borrowed("system-ui")); |
59 |
| - let font_stack_style = StyleProperty::FontStack(font_stack); |
60 |
| - builder.push_default(&font_stack_style); |
61 |
| - builder.push_default(&StyleProperty::LineHeight(1.3)); |
62 |
| - builder.push_default(&StyleProperty::FontSize(16.0)); |
| 59 | + builder.push_default(GenericFamily::SystemUi); |
| 60 | + builder.push_default(StyleProperty::LineHeight(1.3)); |
| 61 | + builder.push_default(StyleProperty::FontSize(16.0)); |
63 | 62 |
|
64 | 63 | // Set the first 4 characters to bold
|
65 | 64 | let bold = FontWeight::new(600.0);
|
66 |
| - let bold_style = StyleProperty::FontWeight(bold); |
67 |
| - builder.push(&bold_style, 0..4); |
| 65 | + builder.push(StyleProperty::FontWeight(bold), 0..4); |
68 | 66 |
|
69 | 67 | builder.push_inline_box(InlineBox {
|
70 | 68 | id: 0,
|
|
0 commit comments