Skip to content

Separate the Text node's generated glyphs into separate vector table rows #2821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 14, 2025

Conversation

BKSalman
Copy link
Contributor

@BKSalman BKSalman commented Jul 2, 2025

This feature was first mentioned in the Discord server, and is being discussed on a dedicated thread

@BKSalman BKSalman force-pushed the glyph-rows branch 2 times, most recently from ea8eb10 to 6ffc93f Compare July 3, 2025 21:19
Copy link
Member

@0HyperCube 0HyperCube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely; thanks for the contribution.

for glyph in glyph_vectors {
let instance = graphene_core::instances::Instance {
instance: glyph,
transform: DAffine2::IDENTITY,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To position the glyph within the text, do we want to apply a transform here instead of to all of the points?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to apply a transform here instead of to all of the points?

I'm sorry, but I couldn't understand what you mean by this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text is shaped by positioning all of the glyphs. Each glyph is offset from the last one by an advance value. The PathBuilder struct then creates the subpaths. Currently, this is achieved by offsetting all of the coordinates within the glyph.

I was suggesting that the origin of the glyph could instead be applied here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do that and push it in a bit

Copy link
Contributor Author

@BKSalman BKSalman Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just rebased, and pushed some changes to do what you requested, however I'm facing some issues

in the image here the transform of the layer is set to 0,0

  1. The dashed bounding box is being drawn under the text, not over it
  2. The only thing that can be selected from the text is the last letter (A in this case), however @Keavon have already answered that, and said it will be fixed in the future
  3. The A highlighting is not positioned on the actual rendered letter
    image

I couldn't find the source of the issue yet, and wanted to give an update

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source of the issue is the fact that instances are broken. However this isn't relevant to this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I see

what should we do, should we wait for that to fixed before merging, or merge for now (if there is no other comments)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure what @Keavon plans to do about the Instances<T> not being implemented properly. Last weekend they expressed a desire to start a refactor, however it seems that no commits in this direction have been made.

The issue is that the editor and tooling frequently use document.metadata.transform_to_viewport(layer_id) and related functions. However since a layer is now made of zero or more instances with different transforms (after another Keavon refactor), this assumption no longer holds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still planning to start on this soon, it's ultra high priority. It's not a merge blocker for this PR.

@Keavon Keavon force-pushed the master branch 4 times, most recently from ec51271 to e025103 Compare July 10, 2025 05:48
@Keavon Keavon changed the title Separate glyphs into Vector data rows Separate the Text node's generated glyphs into separate vector table rows Jul 10, 2025
@Keavon
Copy link
Member

Keavon commented Jul 10, 2025

Please add the checkbox to make this optional (for the moment), when you get the time, thank you!

BKSalman added 3 commits July 11, 2025 23:18
- Properly count characters with
`str.chars().count()` instead of bytes `str.len()`
- Change `String Length` node's output to `u32`
@Keavon Keavon merged commit 166eb00 into GraphiteEditor:master Jul 14, 2025
4 checks passed
@BKSalman BKSalman deleted the glyph-rows branch July 14, 2025 18:55
urisinger pushed a commit to urisinger/Graphite that referenced this pull request Jul 15, 2025
…rows (GraphiteEditor#2821)

* Separate glyphs into Vector data rows

* Fix `String Length` node

- Properly count characters with
`str.chars().count()` instead of bytes `str.len()`
- Change `String Length` node's output to `u32`

* Apply transform on instance instead of applying it when drawing the glyph

* Add checkbox to enable/disable per-glyph instances

* Tooltips

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy