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

Add contour draw option to H.Metrics. #5496

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vasilky3
Copy link

@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.

fontforgeexe/fontview.c Outdated Show resolved Hide resolved
@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
fontforgeexe/fontview.c Outdated Show resolved Hide resolved
fontforge/CMakeLists.txt Show resolved Hide resolved
fontforgeexe/charview.c Show resolved Hide resolved
fontforgeexe/fontview.c Outdated Show resolved Hide resolved
Copy link
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
Contributor

iorsh commented Nov 21, 2024

@skef, please take a look.

int height = 0;
for (spl = set; spl != NULL; spl = spl->next)
{
Color fc = spl->is_clip_path ? clippathcol : fg;
Copy link
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
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
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
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
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
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
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
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
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
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.

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