Certainly! The Hershey Fonts are a set of vector font glyphs mostly used in CAD and engineering contexts. They define characters using a sequence of vector coordinates normalized into a grid and encoded using a custom scheme — each coordinate is a pair of characters starting from 'R' (ASCII 82), representing x and y displacements.
The base index for the extended set is 4000, so the new symbols you want ("Cut Here! Scissor", "Envelope" and other common engineering symbols not in the base Hershey set) should be allocated sequentially from 4000 onward.
How Hershey encoding works (brief recap)
Plan
- Assign indexes and names
- Define stroke data for each symbol (using coordinate pairs)
- Format it as Hershey glyph lines ready for inclusion in a Hershey font file
- Include comments for clarity
1. Assign indexes
- 4000: "Cut Here!" (symbol + text)
- 4001: Scissors icon
- 4002: Envelope
- 4003-n: Other common symbols (I'll add a couple of common ones)
2. Glyph design notes & strokes
-
Coordinates are relative to the origin (horizontal baseline)
-
"Cut Here!" is a text message (for simplicity, perhaps a dashed line with scissor symbol)
-
Scissors: Two crossing blades and handles
-
Envelope: Classic rectangle with vee-shaped flap
3. Hershey glyph format overview example
<index> <left side bearing> <right side bearing> <vector strokes>
Example:
4001 9 15 MWOMOV ROMUV RUMUV
Where:
9 15 are left and right side bearings
M means move pen to that coordinate (start stroke)
R O ... are coordinate point chars
Custom glyphs
Utility: Coordinate mapping
In Hershey, X and Y coordinates are encoded by adding ASCII 'R' (82) to the signed coordinate value:
- e.g., 0 -> 'R' (82)
- -4 -> 'N' (78) since 78+4=82
- +5 -> 'W' (87), etc.
Alphabet is from 'R' (82) for 0 to more positive or negative as needed.
4000: "Cut Here!" Symbol
Let's create a horizontal dashed line with scissor cutting symbol in the middle, and a label "Cut Here!" below it could be just the symbol, text typically is not part of Hershey symbol glyphs but vectors; here we keep it simple:
Width: 30 units (from 0 to 30)
Line: dashed line from 0 to 30 on y=0
Dashes: 0-3, 6-9, 12-15, 18-21, 24-27
Scissor symbol in the middle (x=15)
Encoding:
- Move + Draw from 0 to 3, pen up 3 to 6, line from 6 to 9 ... etc.
Following Hershey code layout (M = pen move, draw sequence points after):
"4000 7 25 MRRRRR DVRRRR MRRRVV DVRRVV MRRRSV RRQSV RSPTV RSPRT"
This is very rough example — let's fully define it stepwise:
Using pairs (X,Y)
- Dash1: 0 to 3 at y=0
- Dash2: 6 to 9 at y=0
- Dash3: 12 to 15 at y=0
- Scissor center from 14-16 with blade and handle
- Dash4: 18 to 21 at y=0
- Dash5: 24 to 27 at y=0
Coordinates mapping example:
- 0 = R (82)
- so for x=0, y=0 -> 'RR'
- x=3 -> 3 + 82 = 85 = 'U'
...
---
**Given complexity, I'll provide actual code snippets for scissors and envelope, which are more critical vector symbols. "Cut here!" can be a text in the UI instead of vector symbol unless strictly needed.**
---
## 4001: Scissors
Design: Two crossing blades and two circular handles.
Coordinates example:
- Left Handle: circle centered at (-5,5), radius 3
- Blade1: line from (-5,5) to (5,-5)
- Blade2: line from (-5,-5) to (5,5)
- Right handle: circle at (10,5), radius 3
Let's define points:
- Handles as polygons (simplified circle shape with 4 points)
Encoding Points:
Use 'R' = 0
Coordinates relative to origin (X,Y):
- Handle left points:
(-8,8), (-2,8), (-2,2), (-8,2)
- Blade1: (-5,5) to (5,-5) (diagonal line)
- Blade2: (-5,-5) to (5,5)
- Handle right points:
(7,8), (13,8), (13,2), (7,2)
Convert to chars:
- For example, x=-8 => 82-8=74='J'
- y=8 => 82+8=90='Z' etc.
Stroke vector:
(M) JZ (Move start left top)
(L) OZ (Draw to)
(L) OV
(L) JV
Then blades
(M) JO (left blade start)
(L) SV (right blade end)
(M) JS (other blade start)
(L) OV (other blade end)
Then right handle:
(M) GZ (etc.)
---
### Full definition for 4001 (Scissors):
4001 10 20
MJZJZOVJV MJOSV MJSOV MGZGZMGMG OZSZOSGV
(This is an example shorthand, the exact coordinates may need to be refined)
---
## 4002: Envelope symbol
Shape: Rectangle with little V flap in top center
Coordinates:
Rectangle: (0,0), (20,0), (20,15), (0,15), (0,0)
Flap: from (0,15) to (10,20) to (20,15)
Mapping:
- (0,0) = R R
- (20,0) = 102 => 82 + 20 = 102 = 'f' (ASCII 102 lowercase) - Not standard, Hershey only uses uppercase letters for code points?
Hershey encoding is limited uppercase letters only, usually from 'R' (82) up to 'Z'(90) + a few others. So 20 units may be too big for coordinate system.
Let's scale coordinates to within ±7
Scale down by a factor ~2.5:
- 20 / 2.5 = 8
So coordinate points:
- Rect 0,0 to 8,0 to 8,6 to 0,6
- Flap: (0,6), (4,8), (8,6)
Then,
- (0,0) R R
- (8,0) W R (82+8=90='Z') (X=8 = 'Z')
- (8,6) Z W (Y=6=82+6=88='X'), double check mapping
- (0,6) R W
Flap: R W (0,6) to U Y (4,8), 4=R+4='V'(86) for x, 8=82+8='Z'(90) for y, so (4,8) = V Z
Then (8,6) = Z W again
So vector lines:
- MRRRR (move 0,0)
- LZRZR (line to 8,0),
- LZXZW (line to 8,6),
- LRZW (line to 0,6),
- LRWR (close rectangle)
- MFZYVZ (move to flap bottom-left at 0,6),
- L VZ (line to flap point at 4,8)
- L ZW (line to flap bottom-right 8,6)
---
### Glyph:
4002 4 12
MRRRR LZRZR LZXZW LRZW LRWR MFZW LVZ LZW
---
## 4003: Common Engineering Symbol — Ground (earth ground)
3 horizontal lines of decreasing length stacked vertically.
Positions:
- Base line at y=0, width 10
- Line1: 10 units (x=0 to x=10) y=0
- Line2: 6 units (x=2 to x=8) y=2
- Line3: 2 units (x=4 to x=6) y=4
Coordinates:
- Line1: MRR (0,0) LWR (10,0)
- Line2: MTT LVP (2,2) to (8,2) where T=84
Mapping:
- x=0 -> R(82)
- x=10 -> 92 char? Not usual, so scale coordinates down to max 7.
Scale 10->7, 2->1.4 ~1, 8->5.6 ~6
Adjusted:
- Line1: 0 to 7 (R to X) y=0 (R)
- Line2: 1 to 6 (S to W) y=2 (T)
- Line3: 3 to 4 (U to V) y=4 (V)
Encoding:
- Line1: MR R R L XR R
- Line2: MS SR T L WR T
- Line3: MU UV V L VV V
---
### Glyph 4003:
4003 2 10
MRRR LWR MSRT LWT MUVL VV
---
## Summary of new symbol glyphs:
4000 7 25 MRRRR DVRRR MRRRV DVRRV MRRRS RRQSV RSPT
4001 10 20 MJZJZOVJV MJOSV MJSOV MGZGZ MGOGV
4002 4 12 MRRR LZRZ LZXZ LRZW LRWR MFZW LVZ LZW
4003 2 10 MRRR LWR MSRT LWT MUVL VV
---
## Notes:
- You need to fine tune exact coordinates to fit your rendering environment
- Left/Right bearings are chosen for reasonable spacing
- The strokes are made simple to communicate symbol shape
- You can expand glyphs by adding strokes: pen-move commands (M) and line-to points (L)
---
If needed, I can prepare full Hershey font file entries or a JSON with details. Just ask!