Skip to content

Add contour draw option to H.Metrics.#5496

Merged
skef merged 6 commits intofontforge:masterfrom
vasilky3:feature/add-contours-to-fontview
Apr 21, 2025
Merged

Add contour draw option to H.Metrics.#5496
skef merged 6 commits intofontforge:masterfrom
vasilky3:feature/add-contours-to-fontview

Conversation

@vasilky3
Copy link
Copy Markdown
Contributor

@vasilky3 vasilky3 commented Nov 14, 2024

I'm working with cnc fonts. And it's hard to navigate dew to lack of glyph splines visualisation in the MainWindow.
So i added one.
image

Type of change

  • New feature

Code quality

I would say it's low. But somewhat consistent with surrounded code.

My main problem new method fontview.c :: FVDrawOutlineOnly() probably should be placed in gdrawP.h :: displayfuncs.
But i was confused trying to figure out how to achieve this.

Sorry for not putting spacing refactor in a separate commit.

Comment thread fontforgeexe/fontview.c Outdated
@vasilky3 vasilky3 force-pushed the feature/add-contours-to-fontview branch from 7d7731d to fdcbda7 Compare November 14, 2024 10:23
@vasilky3 vasilky3 force-pushed the feature/add-contours-to-fontview branch from fdcbda7 to 3a1679d Compare November 14, 2024 10:29
Comment thread fontforgeexe/fontview.c Outdated
Comment thread fontforge/CMakeLists.txt
Comment thread fontforgeexe/charview.c
Comment thread fontforgeexe/charview.c
Comment thread fontforgeexe/fontview.c Outdated
Copy link
Copy Markdown
Contributor

@iorsh iorsh left a comment

Choose a reason for hiding this comment

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

Looks good to me

@iorsh
Copy link
Copy Markdown
Contributor

iorsh commented Nov 21, 2024

@skef, please take a look.

Comment thread fontforgeexe/charview.c
int height = 0;
for (spl = set; spl != NULL; spl = spl->next)
{
Color fc = spl->is_clip_path ? clippathcol : fg;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't tried this, but from the code it seems like you turn on the metrics option and you get the outline in the foreground color? Is that always going to make sense? What if you have a mix of closed and open contours (maybe you're in the middle of developing a stroked font) and want to see the contrast?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess from the attached image it's already a different color ...

Copy link
Copy Markdown
Contributor Author

@vasilky3 vasilky3 Jan 1, 2025

Choose a reason for hiding this comment

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

The image is corresponds to this code.
fg is passed as function argument.

In fontview.c it's called with green color:
CVDrawSplinePointList(NULL, pixmap, sc->layers[1].splines, fvmetadvancetocol, sfm_stroke, x0, y0, (double) (box.width - 1) / sc->vwidth);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, so we're reusing a metrics color: "Color used to draw the (horizontal or) vertical line from the origin to the advance when that metric is selected in View". That's not ideal. Could we maybe add a color to fontview_re?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(I admit this is hairy, as it will also involve changes to the appearance editor ...)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I can see, there is no need to mess with Appearance Editor specifically, the new color definition should show up there automagically.

Copy link
Copy Markdown
Contributor Author

@vasilky3 vasilky3 Feb 2, 2025

Choose a reason for hiding this comment

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

@iorsh thx for info. Helped me alot.

there is no need to mess with Appearance Editor specifically

it's true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@skef,

reusing a metrics color

done

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One more quick thing: Make an entry for this using the case-sensitive string you added in fontview_re ("MetricsGlyphContourColor") around here:

fontforge.FontView.MetricsAdvanceToColor: #008000
. ("Tango" is the current resource directory, I don't think it's necessary to mess with 2012 as well but you're free to.) For the PR you can use 0x3030c0 like you did as the internal program default as long as that makes sense with the other colors, as in:

fontforge.FontView.MetricsGlyphContourColor: #3030C0

but I would also advise changing it and restarting the program to ensure the value is getting picked up properly.

@vasilky3 from your original screenshots it looks like you maybe didn't the resource directory configured for your system, but the more recent screenshot of the appearance editor looks more like what I would expect. Did you change something/get that working?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Here is the result.
image

Previously i was trying to build fontforge from this repo by my own.

This time I did read wiki.
Now I'm using FontForgeBuild repo for building.

Got some problems with understanding how to force it to build my branch. But got it finally.

Copy link
Copy Markdown
Contributor

@skef skef left a comment

Choose a reason for hiding this comment

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

I think this looks OK to me. @iorsh should we merge it?

@iorsh
Copy link
Copy Markdown
Contributor

iorsh commented Apr 21, 2025

I think this looks OK to me. @iorsh should we merge it?

Yes, looks good to me too

@skef skef merged commit 770356c into fontforge:master Apr 21, 2025
7 checks passed
iorsh added a commit to iorsh/fontforge that referenced this pull request Apr 21, 2025
commit 770356c
Author: Vasilii <43271561+vasilky3@users.noreply.github.com>
Date:   Mon Apr 21 10:24:20 2025 +0300

    Add contour draw option to H.Metrics. (fontforge#5496)

commit dc3b1bd
Author: Maxim Iorsh <iorsh@users.sourceforge.net>
Date:   Mon Apr 21 00:22:46 2025 +0300

    Fix memory corruption in SFUnicodeRanges() (fontforge#5537)

commit aedfddb
Author: Maxim Iorsh <iorsh@users.sourceforge.net>
Date:   Mon Apr 21 00:20:21 2025 +0300

    Bump GitHub CI runner to Ubuntu 22 (fontforge#5551)
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