fabric: em-square glyph coordinate convention (EM-X/EM-Y/G-LINE)
Punch list §25 item 4.3.6 complete. capsules/fabric.4th blocks 4916-4917: EM-UNITS, GOX/GOY/GSIZE/GCOLOR, EM-X/EM-Y/G-LINE per §27.6.1, scaling/translating em-square strokes into CART-PLOT screen coordinates via */. Verified live on amd64 via a temporary probe (built, run once, reverted): two G-LINE test shapes at GSIZE 100 and GSIZE 50, one leg each exercising a negative em-y value chosen to hit */'s truncate-toward-zero behaviour, not a multiple of EM-UNITS. Screendump pixel-bbox extraction matched hand-calculated raster coordinates exactly on both shapes. Three-arch acceptance boot clean, Stadium conservation unaffected (resident_sum=43691 reservoir=21845 sum=65536 on all three). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
980f902c7b
commit
82e948afe9
@@ -177,3 +177,23 @@ Block 4915
|
||||
7 6 CCOLOR @ EDGE 6 4 CCOLOR @ EDGE
|
||||
0 4 CCOLOR @ EDGE 1 5 CCOLOR @ EDGE
|
||||
2 6 CCOLOR @ EDGE 3 7 CCOLOR @ EDGE ;
|
||||
|
||||
Block 4916
|
||||
( EM-X/EM-Y: em-square (1000 units/em) -> CART-PLOT space. )
|
||||
( Item 4.3.6. GOX/GOY are the glyph's baseline-left anchor, )
|
||||
( GSIZE the requested pixel size -- set by DRAW-GLYPH later )
|
||||
( (item 4.3.6b), not yet built. )
|
||||
1000 CONSTANT EM-UNITS
|
||||
VARIABLE GOX VARIABLE GOY VARIABLE GSIZE VARIABLE GCOLOR
|
||||
: EM-X ( em-x -- cart-x ) GSIZE @ EM-UNITS */ GOX @ + ;
|
||||
: EM-Y ( em-y -- cart-y ) GSIZE @ EM-UNITS */ GOY @ + ;
|
||||
|
||||
Block 4917
|
||||
( G-LINE: one glyph stroke, em-square coords -> CART-PLOT. )
|
||||
VARIABLE GX1 VARIABLE GY1 VARIABLE GX2 VARIABLE GY2
|
||||
: G-LINE ( gx1 gy1 gx2 gy2 -- )
|
||||
GY2 ! GX2 ! GY1 ! GX1 !
|
||||
GX1 @ EM-X GY1 @ EM-Y 0
|
||||
GX2 @ EM-X GY2 @ EM-Y 0
|
||||
GCOLOR @
|
||||
LINE ;
|
||||
|
||||
Reference in New Issue
Block a user