Skip to content
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

Allow Open Contour Fonts? #459

Closed
HenrySkup opened this issue Dec 8, 2020 · 7 comments · Fixed by #651
Closed

Allow Open Contour Fonts? #459

HenrySkup opened this issue Dec 8, 2020 · 7 comments · Fixed by #651
Assignees
Labels
bug Spec Related to the implementation of the Opentype specification

Comments

@HenrySkup
Copy link

HenrySkup commented Dec 8, 2020

Hi, I was wondering if there is a way to use single line fonts (like those listed here).

Expected Behavior

Screen Shot 2020-12-09 at 00 04 16

Current Behavior

Currently, open paths are automatically closed:

Screen Shot 2020-12-09 at 00 03 37

Possible Solution

I have been able to make it work by removing any "Z" command from the commands list. but this solution seems to be highly situationally dependent.

Context

I'm making a single-line font to use with a pen plotter. (Here is the trial font that I'm using (it only has a few glyphs, FYI).)

The goal is to use this font and easily insert the paths (extracted via opentype.js) into an SVG (or canvas if the need arises).

Your Environment

  • Version used:
  • Font used: see above
  • Browser Name and version: Chrome
  • Operating System and version (desktop or mobile): MacOS
  • Link to your project: n/a
@kevinbarabash
Copy link

Is the stroke width for these fonts defined by the StrokeWidth property in the cff table?

@kevinbarabash
Copy link

I found some info in https://adobe-type-tools.github.io/font-tech-notes/pdfs/T1_SPEC.pdf that describes the different values for PaintType which is one of the fields in the cff table's TopDict:

endchar - endchar (14) |-
finishes a charstring outline definition and must be the last com- mand in a character’s outline (except for accented characters defined using seac). When endchar is executed, Type 1 BuildChar performs several tasks. It executes a setcachedevice operation, using a bounding box it computes directly from the character outline and using the width information acquired from a previ- ous hsbw or sbw operation. (Note that this is not the same order of events as in Type 3 Fonts.) BuildChar then calls a special ver- sion of fill or stroke depending on the value of PaintType in the font dictionary. The Type 1 font format supports only PaintType 0 (fill) and 2 (outline). Note that this single fill or stroke implies that there can be only one path (possibly containing several sub- paths) that can be created to be filled or stroked by the endchar command.

opentype.js should be able to determine whether or not to add Z commands to the path based on the value of PaintType.

@HenrySkup
Copy link
Author

HenrySkup commented Apr 19, 2021

Hi @kevinbarabash,

My StrokeWidth is set, i'll have to check on the PaintType. I'm using fontforge, so I hope that I have access to these options... I'm also not a professional, so please bare with me! 😂
If you have any experience setting these values I would appreciate the help... a little lost here... Would these be set in the font info? i'm not able to find a place to update this info...

@timdiacon
Copy link

Hey @HenrySkup did you ever find a solution to this. I have the same problem I'm trying to use a font from OneLineFonts to engrave text on a CNC machine with files generated through makerjs.

The font has bezier and straight line versions but I get the same problem with both where it seems Opentype is closing the open paths causing duplicate lines in the output.

Did you have any luck with the PaintType thing? If not could you help by pointing me in the right direction to experiment with the Z commands things as I can't see where that is?

@timdiacon
Copy link

@kevinbarabash here's the specific font I'm using in case you are able to help at all, both the bezier and straight line versions attached
Archive.zip
.

@HenrySkup
Copy link
Author

@timdiacon for me the project has been on hold for some time, i will have to check on this. though i think in the end, i did the "remove the z command" route and baked that into the build flow...

@Connum Connum self-assigned this Nov 25, 2023
@Connum Connum added bug Spec Related to the implementation of the Opentype specification labels Nov 25, 2023
@Connum
Copy link
Contributor

Connum commented Nov 25, 2023

I think this should be fairly easy to implement, I'll have a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Spec Related to the implementation of the Opentype specification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants