Open
Conversation
4bf9247 to
197ae43
Compare
Signed-off-by: Nico Burns <nico@nicoburns.com> Ignore out-of-flow boxes for the purpose of whitespace collapsing Rename coords to block Signed-off-by: Nico Burns <nico@nicoburns.com> Fixup tests (inline box kind) Allow the caller to set x/y/max_advance for each line Signed-off-by: Nico Burns <nico@nicoburns.com> Add advance to box yield Align each line to it's own max-width Don't include last line in layout's height if it's empty Fix Cluster::from_point to work with offset lines Signed-off-by: Nico Burns <nico@nicoburns.com> Remove alignment_width argument from tests Use inline min coord in more places Use layout_max_advance for rendering tests Accept new snapshots Signed-off-by: Nico Burns <nico@nicoburns.com> Fix max_advance of f32::MAX MaxLineHeight WIP Signed-off-by: Nico Burns <nico@nicoburns.com> Fix: only InFlow InlineBox's contribute size to the layout Make InlineBoxKind Copy Including InlineBoxKind in PositionedInlineBox Replace break_on_box with InlineBoxKind::CustomOutOfFlow Signed-off-by: Nico Burns <nico@nicoburns.com> Remove is_infinite check in alignment Signed-off-by: Nico Burns <nico@nicoburns.com> Implement yielding when height is exceeded Signed-off-by: Nico Burns <nico@nicoburns.com> Update content_widths_rtl test snapshot Signed-off-by: Nico Burns <nico@nicoburns.com> Fixup swash reference Fixup new tests Fixup vello_cpu_render example Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
…stead Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Splits out a
parley_corecrate from theparleycrate.Motivation
Provide a lower-level API to Parley's core shaping/itemization/analysis pipeline that doesn't require users to buy into the high-level and more opinionated layout APIs.
Changes made
Code moved to
fontiqueFontContexttype (the only code in thefontmodule) was moved tofontiques lib.rs. This is a thin wrapper forfontique::Collectionandfontique::SourceCache.Code moved to
parley_coreThe
shape,analysis, andbidimodules. These modules collectively form the "meat" of Parley's core pipeline.The
lru_cacheandconvertmodules. These are utilities which are only used by theshapemodule.The
styleandinline_boxmodules. These are shared types that are needed by the core.The
resolve/mod.rsmodule (but notresolve/tree.rsorresolve/range.rs) (asresolve.rs). This converts user input styles into "resolved styles". Long-term it may be possible for this to live outside of "core", but for now it's easiest if it's included.Two small methods that convert
ResolvedStyleandResolvedDecorationintolayout::Styleandlayout::Decorationwere moved out ofresolve/mod.rsinto thelayoutmodule to avoid a core module referencing a non-core module.Most of
layout/data.rs, and all of the smalllayout/glyph.rs. This includes:LayoutItem,LayoutItemKind,RunData,RunMetrics,ClusterData,ClusterInfoandGlyph). These have been moved to a newshape/data.rsmodule. The wrapper types (Run,Cluster, etc) that hold a reference to these data type and implement a bunch of useful methods on them have not been moved.LayoutData::push_runmethod (and it's two helpersprocess_clustersandpush_cluster). These contain complex logic which is really part of the core pipeline, and have have moved intoshape/push_run.rs.A
ParleyCoreContexthas been split out ofLayoutContext. The bulk of the context has been moved intoParleyCoreContext.LayoutContextnow wrapsParleyCoreContextand also retains theTreeStyleBuilderandRangeStyleBuilderfields.The
StyleRunBuilderhas been moved intoparley_core(builder.rs).The
nearly_eqfunction from theutilmodule was duplicated intoparley_core(the rest ofutilremains inparley)The
tests/test_analysismodule. This has been lightly modified to not depend on theRangeBuilder.Code that remains in
parleylayoutmodule (except for parts oflayout/data.rsdetailed above)editingmoduleTreeBuilder,TreeStyleBuilder,RangedBuilder, andRangedStyleBuilder(resolve/tree.rs,resolve/range.rs, and most ofbuilder.rs)settingmodule was folded intolib.rs. It was just a few re-exports.tests/test_buildersandtests/utilsmodules.LayoutContextandParleyCoreContextThe
ShapeSinktraitA few parts of the core pipeline (the
shape_item,push_runfunctions in theshapemodule, and thebuild_into_layoutmethod in thecontextmodule) reference thelayout::Layout/layout::layoutDatatypes in thelayoutmodule in order to push data into it.This dependency does not work with the crate split, so in order to break it I have introduced
ShapeSinktrait. This trait is defined inshape/push_run.rs, the functions above call methods on the trait, and it implemented by thelayout::LayoutDatatype in theparleycrate.I have also added a
ShapedTextstruct inparley_corethat also implements this trait, this provides a default concrete repesentation of "all of the output of shaping". Using this would likely make sense for non-parley Rust consumers ofparley_core, and future it could be also be used internally by Parley'sLayoutDatastruct. This type (or a wrapper of if) could also eventually gain some low-level layout primitives/helpers.The
ShapeSinktrait is currently defined as follows:Open Questions
Does the
StyleRunBuilderbelong in core? I currently have it there and the idea was thatRangeBuilderandTreeBuildercould build on top of it. However, I've found the API awkward for that purpose (forcing less efficient allocation patterns), and I'm now thinking we ought to expose some of the fields inParleyCoreContextpublically, and just carefully document the invariants.Then for now, the
StyleRunBuildercould move back toparleywith the other builders. And we can follow-up by splitting these out into individual crates if that is desired.Future possibilties
RangeBuilder,TreeBuilder,StyleRunBuilder) so that (along with their coresponding "style builders (RangeStyleBuilder,TreeStyleBuilder) they can each live in their own standalone crates that depend only onparley_core. The key here would be to have the builder (e.g.RangeBuilder) depend onParleyCoreContextand it's style builder (e.g.RangeStyleBuilder) rather than onLayoutContextas they currently so in Parleymain(and still do in this PR).parley_core. These would be "primitives" like "find the next break point" that could be built on to build a variety of different high-level layout strategies.parley_core. Consumers ofparley_coreshould resolve scale themselves before passing data into core.parleyandparley_corefrom Fontiqueparley_core(and possibly alsoparley), by creating a trait that allows users to provide resolved styles on demand.