mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
Instance tables refactor part 1: wrap graphical data in the new Instances<T> struct (#2230)
* Port VectorData to Instances<VectorData> * Port ImageFrame<P> and TextureFrame to Instances<ImageFrame<P>> and Instances<TextureFrame> * Avoid mutation with the TransformMut trait * Port GraphicGroup to Instances<GraphicGroup> * It compiles! * Organize debugging * Document upgrading * Fix Brush node * Restore TransformMut in lieu of TransformSet trait * Fix tests * Final code review
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use crate::vector::{VectorData, VectorDataTable};
|
||||
|
||||
use graph_craft::wasm_application_io::WasmEditorApi;
|
||||
use graphene_core::text::TypesettingConfig;
|
||||
pub use graphene_core::text::{bounding_box, load_face, to_path, Font, FontCache};
|
||||
@@ -13,7 +15,7 @@ fn text<'i: 'n>(
|
||||
#[default(1.)] character_spacing: f64,
|
||||
#[default(None)] max_width: Option<f64>,
|
||||
#[default(None)] max_height: Option<f64>,
|
||||
) -> crate::vector::VectorData {
|
||||
) -> VectorDataTable {
|
||||
let buzz_face = editor.font_cache.get(&font_name).map(|data| load_face(data));
|
||||
|
||||
let typesetting = TypesettingConfig {
|
||||
@@ -23,5 +25,8 @@ fn text<'i: 'n>(
|
||||
max_width,
|
||||
max_height,
|
||||
};
|
||||
crate::vector::VectorData::from_subpaths(to_path(&text, buzz_face, typesetting), false)
|
||||
|
||||
let result = VectorData::from_subpaths(to_path(&text, buzz_face, typesetting), false);
|
||||
|
||||
VectorDataTable::new(result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user