Skip to content

Commit

Permalink
Add support for local() fonts
Browse files Browse the repository at this point in the history
This implements boxesandglue/boxesandglue#5

Update to latest boxes and glue
  • Loading branch information
pgundlach committed Jul 11, 2023
1 parent d4cdd71 commit a727109
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 10 deletions.
53 changes: 50 additions & 3 deletions core/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1094,11 +1094,27 @@ func cmdNextRow(xd *xtsDocument, layoutelt *goxml.Element) (xpath.Sequence, erro
}

func cmdOl(xd *xtsDocument, layoutelt *goxml.Element) (xpath.Sequence, error) {
var err error
attValues := &struct {
Class string
ID string
Style string
}{}
if err = getXMLAttributes(xd, layoutelt, attValues); err != nil {
return nil, err
}

seq, err := dispatch(xd, layoutelt, xd.data)
if err != nil {
return nil, err
}
n, err := xd.getTextvalues("ol", seq, map[string]string{}, "cmdol", layoutelt.Line)
attributes := map[string]string{
"class": attValues.Class,
"id": attValues.ID,
"style": attValues.Style,
}

n, err := xd.getTextvalues("ol", seq, attributes, "cmdol", layoutelt.Line)
return xpath.Sequence{n}, err
}

Expand Down Expand Up @@ -1939,20 +1955,51 @@ func cmdTrace(xd *xtsDocument, layoutelt *goxml.Element) (xpath.Sequence, error)
}

func cmdU(xd *xtsDocument, layoutelt *goxml.Element) (xpath.Sequence, error) {
var err error
attValues := &struct {
Class string
ID string
Style string
}{}
if err = getXMLAttributes(xd, layoutelt, attValues); err != nil {
return nil, err
}

seq, err := dispatch(xd, layoutelt, xd.data)
if err != nil {
return nil, err
}
n, err := xd.getTextvalues("u", seq, map[string]string{}, "cmdU", layoutelt.Line)
attributes := map[string]string{
"class": attValues.Class,
"id": attValues.ID,
"style": attValues.Style,
}

n, err := xd.getTextvalues("u", seq, attributes, "cmdU", layoutelt.Line)
return xpath.Sequence{n}, err
}

func cmdUl(xd *xtsDocument, layoutelt *goxml.Element) (xpath.Sequence, error) {
var err error
attValues := &struct {
Class string
ID string
Style string
}{}
if err = getXMLAttributes(xd, layoutelt, attValues); err != nil {
return nil, err
}

seq, err := dispatch(xd, layoutelt, xd.data)
if err != nil {
return nil, err
}
n, err := xd.getTextvalues("ul", seq, map[string]string{}, "cmdul", layoutelt.Line)
attributes := map[string]string{
"class": attValues.Class,
"id": attValues.ID,
"style": attValues.Style,
}
n, err := xd.getTextvalues("ul", seq, attributes, "cmdul", layoutelt.Line)
return xpath.Sequence{n}, err
}

Expand Down
4 changes: 2 additions & 2 deletions core/fonts.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func (xd *xtsDocument) defaultfont() error {
return err
}
fs := frontend.FontSource{
Name: font.fontname,
Source: fn,
Name: font.fontname,
Location: fn,
}
fontsources[font.fontname] = &fs
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/speedata/bagme v0.0.0-20230623185222-e07a73460716
github.com/speedata/barcode v0.0.0-20230307084753-486c4d51cb34
github.com/speedata/baseline-pdf v0.0.0-20230626115456-1e81e9807a83
github.com/speedata/boxesandglue v0.0.0-20230709184652-477ef1a07098
github.com/speedata/boxesandglue v0.0.0-20230711120956-e498dcb50ee4
github.com/speedata/goxlsx v1.0.2
github.com/speedata/goxml v0.0.0-20230322084327-216af189a791
github.com/speedata/goxpath v0.0.0-20230709190058-ca75de231e9c
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ github.com/speedata/barcode v0.0.0-20230307084753-486c4d51cb34 h1:FeXq9Yh4eiH+dq
github.com/speedata/barcode v0.0.0-20230307084753-486c4d51cb34/go.mod h1:BNwJ2io3ZgecUqunSUFAlfnnI8YTh3SLSHZgs5vaoTY=
github.com/speedata/baseline-pdf v0.0.0-20230626115456-1e81e9807a83 h1:v+XfQInGo4k4735Ee9PN1ghRXCeSy6EgYuCNTKEd4zk=
github.com/speedata/baseline-pdf v0.0.0-20230626115456-1e81e9807a83/go.mod h1:ptfWHTOg/v3zstZUxF9DwET4q4NOMCGyzDvtm11SIWs=
github.com/speedata/boxesandglue v0.0.0-20230709184652-477ef1a07098 h1:wJDL5HfXLZpKxoV6x30CfHGz5SgPXi9vbojGngSweMU=
github.com/speedata/boxesandglue v0.0.0-20230709184652-477ef1a07098/go.mod h1:Q/uqAyp+rb9rJHTIoUlKjucX/DtDsdbAhLy/AOn26lU=
github.com/speedata/boxesandglue v0.0.0-20230711120956-e498dcb50ee4 h1:zXrG+WeF/7oTMdGTVQ0VTTgxagz6jLTi81lZTv+HnTk=
github.com/speedata/boxesandglue v0.0.0-20230711120956-e498dcb50ee4/go.mod h1:Q/uqAyp+rb9rJHTIoUlKjucX/DtDsdbAhLy/AOn26lU=
github.com/speedata/css/scanner v0.0.0-20201005071706-2ed32c3ce553 h1:L9Sqi5S7G4JjODI5tZZ1IzZ7Yb4s71xFOq/uZtLv1Wg=
github.com/speedata/css/scanner v0.0.0-20201005071706-2ed32c3ce553/go.mod h1:uF4+EGySaBnGeZpXZ0boh/oR6P0vNiYfQ2MAJXCU9hE=
github.com/speedata/gofpdi v1.0.18 h1:LEiIN62ckZcA4n8AtBu16M2P2fBK3OnwpTGDfe13v/4=
Expand All @@ -39,8 +39,6 @@ github.com/speedata/goxlsx v1.0.2 h1:hi00xy1EQhqrag4HNIc9hVEtVmTGrh3z9C1AH9ysg74
github.com/speedata/goxlsx v1.0.2/go.mod h1:7eXkL4ZUZ2uUlnBBAmh0iwOdhOkqqstW/FmkEe2IPMY=
github.com/speedata/goxml v0.0.0-20230322084327-216af189a791 h1:TuFrswsnJYDeyR47dXhTLzSp3GwvhPRUrRSyEXyxrGg=
github.com/speedata/goxml v0.0.0-20230322084327-216af189a791/go.mod h1:G++cv0h2rC8ltAhvQmANDgwMbKRd3MetXlF8PLob6dw=
github.com/speedata/goxpath v0.0.0-20230607131939-3c391168ab40 h1:s7YDoiHouElOtm15yHLEmLlBI4aYCbLkTLAyLM/mXg0=
github.com/speedata/goxpath v0.0.0-20230607131939-3c391168ab40/go.mod h1:/9JLhISqlVrHRfRhf0B6d15a3TV+q4ertfm67S/q9Us=
github.com/speedata/goxpath v0.0.0-20230709190058-ca75de231e9c h1:UHPI8EkvpM2dSSrRrXRK6IjcC2cS6/u6ED6eHIUhUKk=
github.com/speedata/goxpath v0.0.0-20230709190058-ca75de231e9c/go.mod h1:/9JLhISqlVrHRfRhf0B6d15a3TV+q4ertfm67S/q9Us=
github.com/speedata/hyphenation v1.0.2 h1:2rDCtAqNfbf+E56SsqbmNApsVx9CH+4fwIh1RZuu3B8=
Expand Down

0 comments on commit a727109

Please sign in to comment.