microsoft / microsoft/maker.js

Text union

Open
#532 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2k
Forks
302
Avg merge
21h 28m
Merged PRs (30d)
5

Description

Hi @danmarshall thanks for pointing me here. I understand the use case for maker js is to draw outlines and that fill happens post exportation. That's what I've done. However, due to the glyph parts the fill results in white spaces. Clearly demonstrated by an A.

Screen Shot 2022-06-25 at 12 24 18 pm Screen Shot 2022-06-25 at 12 25 19 pm

My approach to resolving this would be to union the parts of the glyph. This doesn't seem to be exposed on MakerJs.models.Text. I planned to use MakerJs.model.combineUnion on a glyphs child models, but the A glyph doesn't have child models. I assume this would negatively effect an "O". Am I missing something?

{
  paths: {
    p_1: Line { type: 'line', origin: [Array], end: [Array] },
    p_2: Line { type: 'line', origin: [Array], end: [Array] },
    p_3: Line { type: 'line', origin: [Array], end: [Array] },
    p_4: Line { type: 'line', origin: [Array], end: [Array] },
    p_5: Line { type: 'line', origin: [Array], end: [Array] },
    p_6: Line { type: 'line', origin: [Array], end: [Array] },
    p_7: Line { type: 'line', origin: [Array], end: [Array] },
    p_8: Line { type: 'line', origin: [Array], end: [Array] },
    p_9: Line { type: 'line', origin: [Array], end: [Array] },
    p_10: Line { type: 'line', origin: [Array], end: [Array] },
    p_11: Line { type: 'line', origin: [Array], end: [Array] },
    p_12: Line { type: 'line', origin: [Array], end: [Array] }
  },
  origin: [ 24.90340909090909, 0 ]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MakerJs.models.Text and model.combineUnion, then reproduce the fill behavior using glyphs such as A and O. Inspect how glyph paths and child models are represented, and verify the exported result is filled without unwanted white spaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.