luv

Workshop wiki

slug-truetype.lisp

hal/shader/slug-truetype.lisp

system luv · 8 definitions · on GitHub

TrueType outlines enter Slug before McCLIM's software rasterizer.

in-package#:luv.slug
defstructslug-glyphcharacteroutlineadvance-widthleft-side-bearingunits-per-em
defunslug-point-from-zpb
point
make-slug-point:x
zpb-ttf:xpoint
:y
zpb-ttf:ypoint
defunslug-outline-from-zpb-glyph
glyph

Convert ZPB-TTF's resolved line/quadratic segments to a Slug outline.

let
contours
zpb-ttf:do-contours
contourglyph
let
curves
zpb-ttf:do-contour-segments
startcontrolend
contour
let
slug-start
push
ifcontrol
make-slug-quadratic:startslug-start:control:endslug-end
make-slug-lineslug-startslug-end
curves
push
nreversecurves
contours
make-slug-outline:contours
nreversecontours
defunmake-slug-glyph-from-zpb-glyph
glyphfont-loader&keycharacter

Capture one ZPB-TTF glyph's outline and placement metrics for Slug.

make-slug-glyph:charactercharacter:outline:advance-width
zpb-ttf:advance-widthglyph
:left-side-bearing
zpb-ttf:left-side-bearingglyph
:units-per-em
zpb-ttf:units/emfont-loader
defunload-slug-glyph
characterfont-loader

Find character in font-loader and capture its Slug outline and metrics.

make-slug-glyph-from-zpb-glyph
zpb-ttf:find-glyphcharacterfont-loader
font-loader:charactercharacter
defunload-slug-glyph-index
glyph-indexfont-loader

Capture HarfBuzz glyph-index from font-loader as a Slug glyph.

make-slug-glyph-from-zpb-glyph
zpb-ttf:index-glyphglyph-indexfont-loader
font-loader
defunmap-slug-outline-points
functionoutline

Return an outline whose points are the result of calling function on x/y.

labels
map-point
point
multiple-value-bind
xy
funcallfunction
slug-point-xpoint
slug-point-ypoint
make-slug-point:xx:yy
map-curve
curve
make-slug-quadratic:start
map-point
slug-quadratic-startcurve
:control
map-point
slug-quadratic-controlcurve
:end
map-point
slug-quadratic-endcurve
make-slug-outline:contours
loopforcontourin
slug-outline-contoursoutline
collect
mapcar#'map-curvecontour
defunnormalize-slug-glyph-outline
glyph

Return glyph's outline in em units, preserving its TrueType origin.

let
units-per-em
slug-glyph-units-per-emglyph
unless
pluspunits-per-em
error'slug-outline-error:reason:invalid-units-per-em:detailsunits-per-em
map-slug-outline-points
lambda
xy
values
/xunits-per-em
/yunits-per-em
slug-glyph-outlineglyph