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 UI to see/adjust character position attributes #5

Open
JoeStrout opened this issue Sep 28, 2022 · 0 comments
Open

Add UI to see/adjust character position attributes #5

JoeStrout opened this issue Sep 28, 2022 · 0 comments

Comments

@JoeStrout
Copy link
Owner

Each character in a BMF font has the following attributes controlling how it is drawn:

  • relX: how much the glyph image is shifted to the right, in pixels, relative to the current draw position
  • relY: how much the glyph image is shifted down, in pixels, relative to the baseline
  • shift: how much the draw position is shifted to the right after drawing, to prepare for the next character.

In addition, there are these properties implied by the glyph image itself:

  • image width (in pixels)
  • image height (in pixels)

We need some UI to let the user see and adjust these for each glyph. I'm thinking something like a yellow cross which indicates the draw position and baseline; and the right limb of this cross could extend to the right, ending in an arrow, to show the shift. These would be in addition to the current white box which shows the image bounds.

Replace the current "Image Shift" tool (top row, third tool from the left) with a "Metrics" tool (don't worry about the icon; I'll provide something once the functionality is settled down). When that tool is selected, clicking and dragging in the editing area should have the following effects:

  • Near the draw position/baseline cross: adjust relX and relY as mouse is dragged horizontally and vertically.
  • Near the arrow head: adjust shift (horizontally only).
  • Near the left side of the image box: adjust image width and relX (so that right side of the image, and the draw position cross, stay put).
  • Near the right side of the image box: adjust image width (keeping left side of image and draw position still).
  • Near the top side of the image box: adjust image height and relY (keeping bottom side of image and draw position still).
  • Near the bottom side of the image box: adjust image height (keeping top side of image and draw position still).

These changes should be written directly to the character position in the font data, so that if you switch to another glyph, then switch back, everything is as you left it.

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

No branches or pull requests

1 participant