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

refactor: Remove undocumented experimental roughunder command #18

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions packages/framebox/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -259,38 +259,6 @@ function package:registerCommands ()
end)
end, "Frames content in a box with curly brace(s).")

-- EXPERIMENTAL (UNDOCUMENTED)

-- This would need to be reimplemented and checked after multiline effects
-- (e.g. multiline links and underline) are possibly added to the
-- typetter.
self:registerCommand("roughunder", function (options, content)
-- Begin taken from the original underline command (rules package)
local ot = require("core/opentype-parser")
local fontoptions = SILE.font.loadDefaults({})
local face = SILE.font.cache(fontoptions, SILE.shaper.getFace)
local font = ot.parseFont(face)
local upem = font.head.unitsPerEm
local underlinePosition = -font.post.underlinePosition / upem * fontoptions.size
local underlineThickness = font.post.underlineThickness / upem * fontoptions.size
-- End taken from the original underline command (rules package)

local hbox, hlist = SILE.typesetter:makeHbox(content)
local roughOpts = {}
if options.roughness then roughOpts.roughness = SU.cast("number", options.roughness) end
if options.bowing then roughOpts.bowing = SU.cast("number", options.bowing) end
roughOpts.preserveVertices = true
roughOpts.disableMultiStroke = true
roughOpts.strokeWidth = underlineThickness

frameHbox(hbox, hlist, nil, function(w, h, d)
-- NOTE: Using some arbitrary 1.5 factor, since those sketchy lines are
-- probably best a bit more lowered than intended...
local y = h + d + 1.5 * underlinePosition
local painter = PathRenderer(RoughPainter())
return painter:line(0, y, w, y, roughOpts)
end)
end, "Underlines some content (experimental, undocumented)")
end

package.documentation = [[
Expand Down