Skip to content

Commit

Permalink
B: zero width space
Browse files Browse the repository at this point in the history
This fixes #552
  • Loading branch information
pgundlach committed Jan 2, 2024
1 parent 56ba99c commit 87ae250
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 6 deletions.
3 changes: 3 additions & 0 deletions qa/paragraph/zwspaceerror/data.xml
@@ -0,0 +1,3 @@
<data>
<title>a&#8203;b</title>
</data>
14 changes: 14 additions & 0 deletions qa/paragraph/zwspaceerror/layout.xml
@@ -0,0 +1,14 @@
<Layout
xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Pageformat height="3cm" width="3cm" />
<Record element="data">
<PlaceObject>
<Textblock>
<Paragraph>
<Value select="title" />
</Paragraph>
</Textblock>
</PlaceObject>
</Record>
</Layout>
1 change: 1 addition & 0 deletions qa/paragraph/zwspaceerror/publisher.cfg
@@ -0,0 +1 @@
fontloader=fontforge
Binary file added qa/paragraph/zwspaceerror/reference.pdf
Binary file not shown.
13 changes: 13 additions & 0 deletions qa/paragraph/zwspaceerror_hb/layout.xml
@@ -0,0 +1,13 @@
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">

<Record element="data">
<PlaceObject>
<Textblock>
<Paragraph>
<Value>&#8203; text</Value>
</Paragraph>
</Textblock>
</PlaceObject>
</Record>
</Layout>
2 changes: 2 additions & 0 deletions qa/paragraph/zwspaceerror_hb/publisher.cfg
@@ -0,0 +1,2 @@
dummy=true
fontloader=harfbuzz
Binary file added qa/paragraph/zwspaceerror_hb/reference.pdf
Binary file not shown.
13 changes: 7 additions & 6 deletions src/lua/publisher.lua
Expand Up @@ -4745,7 +4745,9 @@ function hbglyphlist(arguments)
set_attribute(n,"bgpaddingbottom",parameter.bg_padding_bottom)
end
end
set_attribute(n,"fontfamily",fontfamily)
if n then
set_attribute(n,"fontfamily",fontfamily)
end
elseif cp == 0 and newlines_at[thisglyph.cluster] then
local dummypenalty
dummypenalty = node.new("penalty")
Expand Down Expand Up @@ -5070,11 +5072,10 @@ local function ffglyphlist(arguments)
n.subtype = 1
head, last = node.insert_after(head,last,n)
elseif s == 8203 then
-- U+200B ZERO WIDTH SPACE
p = node.new("penalty")
p.penalty = -10
head = p
last = node.tail(head)
local n = set_glue(nil,{width = 0 },"uc=8203")
-- prevent from stretching with ragged shape
n.subtype = 1
head, last = node.insert_after(head,last,n)
-- anchor is necessary. Otherwise à (C3A0) would match A0 - %s
elseif match(char,"^%s$") then -- Space
if breakatspace == false then
Expand Down

0 comments on commit 87ae250

Please sign in to comment.