From c2c608b4a1c1239e8fe3b8594bbbbef3eb84da0f Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 3 Oct 2024 17:43:07 +0300 Subject: [PATCH] feat(shapers): Add dummy shaper for use with alternative backends that don't need shaping --- core/sile.lua | 4 ++-- shapers/dummy.lua | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 shapers/dummy.lua diff --git a/core/sile.lua b/core/sile.lua index 5ba8cca61..1c8bf90a4 100644 --- a/core/sile.lua +++ b/core/sile.lua @@ -222,10 +222,10 @@ function SILE.init () SILE.shaper = SILE.shapers.harfbuzz() SILE.outputter = SILE.outputters.debug() elseif SILE.backend == "text" then - SILE.shaper = SILE.shapers.harfbuzz() + SILE.shaper = SILE.shapers.dummy() SILE.outputter = SILE.outputters.text() elseif SILE.backend == "dummy" then - SILE.shaper = SILE.shapers.harfbuzz() + SILE.shaper = SILE.shapers.dummy() SILE.outputter = SILE.outputters.dummy() end SILE.pagebuilder = SILE.pagebuilders.base() diff --git a/shapers/dummy.lua b/shapers/dummy.lua new file mode 100644 index 000000000..ebccab530 --- /dev/null +++ b/shapers/dummy.lua @@ -0,0 +1,28 @@ +local base = require("shapers.base") + +local shaper = pl.class(base) +shaper._name = "dummy" + +function shaper.addShapedGlyphToNnodeValue (_, _, _) end + +function shaper.checkHBProblems (_, _, _) end + +function shaper.debugVersions (_) end + +function shaper.getFace () end + +function shaper.makeSpaceNode (_, _, _) end + +function shaper.preAddNodes (_, _, _) end + +function shaper:createNnodes (_, _) end + +function shaper:formNnode (_, _, _) end + +function shaper:measureChar (_) end + +function shaper:measureSpace (_) end + +function shaper:shapeToken (_, _) end + +return shaper