gnu: Add go-github-com-wraparound-wrap.

* gnu/packages/patches/go-github-com-wraparound-wrap-free-fonts.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/golang.scm (go-github-com-wraparound-wrap): New variable.
This commit is contained in:
Liliana Marie Prikler 2023-08-21 20:23:37 +02:00
parent ae2fe75be1
commit c705c522e4
No known key found for this signature in database
GPG Key ID: 442A84B8C70E2F87
3 changed files with 137 additions and 0 deletions

View File

@ -1316,6 +1316,7 @@ dist_patch_DATA = \
%D%/packages/patches/go-github-com-golang-snappy-32bit-test.patch \
%D%/packages/patches/go-github-com-urfave-cli-fix-tests.patch \
%D%/packages/patches/go-github-com-urfave-cli-v2-fix-tests.patch \
%D%/packages/patches/go-github-com-wraparound-wrap-free-fonts.patch \
%D%/packages/patches/go-skip-gc-test.patch \
%D%/packages/patches/gourmet-sqlalchemy-compat.patch \
%D%/packages/patches/gpaste-fix-paths.patch \

View File

@ -74,6 +74,7 @@
#:use-module (gnu packages base)
#:use-module ((gnu packages bootstrap) #:select (glibc-dynamic-linker))
#:use-module (gnu packages check)
#:use-module (gnu packages fonts)
#:use-module (gnu packages gcc)
#:use-module (gnu packages glib)
#:use-module (gnu packages gnupg)
@ -2512,6 +2513,57 @@ TrueType font files in your system's user and system font directories.")
(description "gopdf is a Go library for generating PDF documents.")
(license license:expat)))
(define-public go-github-com-wraparound-wrap
(package
(name "go-github-com-wraparound-wrap")
(version "0.3.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Wraparound/wrap")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0scf7v83p40r9k7k5v41rwiy9yyanfv3jm6jxs9bspxpywgjrk77"))
(patches (search-patches
"go-github-com-wraparound-wrap-free-fonts.patch"))))
(build-system go-build-system)
(arguments
(list
#:import-path "github.com/Wraparound/wrap/"
#:tests? #f ; no tests
#:phases
#~(modify-phases %standard-phases
(replace 'build
(lambda* (#:key import-path #:allow-other-keys)
(invoke "go" "install" "-v" "-x"
"-ldflags=-s -w"
(string-append import-path "cmd/wrap"))))
(add-after 'wrap 'wrap-fonts
(lambda* (#:key inputs outputs #:allow-other-keys)
(for-each
(lambda (program)
(wrap-program program
`("XDG_DATA_DIRS" suffix
,(map dirname
(search-path-as-list '("share/fonts")
(map cdr inputs))))))
(find-files (string-append (assoc-ref outputs "out")
"/bin"))))))))
(propagated-inputs (list go-github-com-spf13-cobra
go-github-com-signintech-gopdf
go-github-com-flopp-go-findfont))
(inputs (list font-liberation font-gnu-freefont))
(home-page "https://github.com/Wraparound/wrap")
(synopsis "Format Fountain screenplays")
(description
"Wrap is a command line tool that is able to convert Fountain files into a
correctly formatted screen- or stageplay as an HTML or a PDF. It supports
standard Fountain, but also has some custom syntax extensions such as
translated keywords and acts.")
(license license:gpl3)))
(define-public go-torproject-org-pluggable-transports-goptlib
(package
(name "go-torproject-org-pluggable-transports-goptlib")

View File

@ -0,0 +1,84 @@
Index: wrap-source/pkg/pdf/fonts.go
===================================================================
--- wrap-source.orig/pkg/pdf/fonts.go
+++ wrap-source/pkg/pdf/fonts.go
@@ -36,15 +36,15 @@ var (
BoldItalic: []string{"Courier Prime Bold Italic.ttf"},
}
- CourierNew = Font{
- RomanName: "Courier New",
- Roman: []string{"Courier New.ttf", "cour.ttf"},
- BoldName: "Courier New Bold",
- Bold: []string{"Courier New Bold.ttf", "courbd.ttf"},
- ItalicName: "Courier New Italic",
- Italic: []string{"Courier New Italic.ttf", "couri.ttf"},
- BoldItalicName: "Courier New Bold Italic",
- BoldItalic: []string{"Courier New Bold Italic.ttf", "courbi.ttf"},
+ LiberationMono = Font{
+ RomanName: "Liberation Mono Regular",
+ Roman: []string{"LiberationMono-Regular.ttf"},
+ BoldName: "Liberation Mono Bold",
+ Bold: []string{"LiberationMono-Bold.ttf"},
+ ItalicName: "Liberation Mono Italic",
+ Italic: []string{"LiberationMono-Italic.ttf"},
+ BoldItalicName: "Liberation Mono Bold Italic",
+ BoldItalic: []string{"LiberationMono-BoldItalic.ttf"},
}
FreeMono = Font{
@@ -151,9 +151,8 @@ func loadFonts() {
err := loadFont(CourierPrime)
if err != nil {
- // Courier New should be available on macOS and Windows
fmt.Fprintln(os.Stderr, "Warning: "+err.Error())
- err = loadFont(CourierNew)
+ err = loadFont(LiberationMono)
if err != nil {
// FreeMono as a final attempt
Index: wrap-source/pkg/cli/pdf.go
===================================================================
--- wrap-source.orig/pkg/cli/pdf.go
+++ wrap-source/pkg/cli/pdf.go
@@ -22,7 +22,7 @@ var pdfCmd = &cobra.Command{
var (
pdfProductionFlag bool
useCourierPrime bool
- useCourierNew bool
+ useLiberationMono bool
useFreeMono bool
pageSize string
font string
@@ -31,7 +31,7 @@ var (
func init() {
pdfCmd.Flags().BoolVarP(&pdfProductionFlag, "production", "p", false, "add scene numbers and other production text")
pdfCmd.Flags().BoolVar(&useCourierPrime, "use-courier-prime", false, "force the usage of Courier Prime")
- pdfCmd.Flags().BoolVar(&useCourierNew, "use-courier-new", false, "force the usage of Courier New")
+ pdfCmd.Flags().BoolVar(&useLiberationMono, "use-courier-new", false, "force the usage of Liberation Mono")
pdfCmd.Flags().BoolVar(&useFreeMono, "use-freemono", false, "force the usage of GNU FreeMono")
pdfCmd.Flags().StringVar(&pageSize, "page-size", "", "choose page size (letter or a4)")
pdfCmd.RegisterFlagCompletionFunc("page-size", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
@@ -46,8 +46,8 @@ func pdfRun(cmd *cobra.Command, args []s
// Evaluate font selection
pdf.AutoFontSelection = false
- if (font != "" && atLeastOne(useCourierPrime, useCourierNew, useFreeMono)) ||
- moreThanOne(useCourierPrime, useCourierNew, useFreeMono) {
+ if (font != "" && atLeastOne(useCourierPrime, useLiberationMono, useFreeMono)) ||
+ moreThanOne(useCourierPrime, useLiberationMono, useFreeMono) {
// The fonts are mutualy exclusive so throw an error
handle(errors.New("tried to force multiple fonts at the same time"))
}
@@ -77,8 +77,8 @@ func pdfRun(cmd *cobra.Command, args []s
} else if useCourierPrime {
pdf.SelectedFont = pdf.CourierPrime
- } else if useCourierNew {
- pdf.SelectedFont = pdf.CourierNew
+ } else if useLiberationMono {
+ pdf.SelectedFont = pdf.LiberationMono
} else if useFreeMono {
pdf.SelectedFont = pdf.FreeMono