Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -87,7 +87,7 @@ func resolveAssetPath(fileName string, relativeDirs []string) (string, error) {
|
||||
return "", fmt.Errorf("asset not found: %s (tried: %s)", fileName, strings.Join(tried, ", "))
|
||||
}
|
||||
|
||||
func registerDejavuFonts(pdf *gofpdf.Fpdf, regularFamily, boldFamily string) error {
|
||||
func registerDejavuFonts(pdf *gofpdf.Fpdf) error {
|
||||
|
||||
regPath, err := resolvePdfAssetPath("DejaVuSans.ttf")
|
||||
if err != nil {
|
||||
@@ -99,20 +99,19 @@ func registerDejavuFonts(pdf *gofpdf.Fpdf, regularFamily, boldFamily string) err
|
||||
return err
|
||||
}
|
||||
|
||||
// Load fonts from bytes
|
||||
// SAME FAMILY: "dejavu"
|
||||
pdf.AddUTF8FontFromBytes(
|
||||
regularFamily,
|
||||
"dejavu",
|
||||
"",
|
||||
mustReadFile(regPath),
|
||||
)
|
||||
|
||||
pdf.AddUTF8FontFromBytes(
|
||||
boldFamily,
|
||||
"dejavu",
|
||||
"B",
|
||||
mustReadFile(boldPath),
|
||||
)
|
||||
|
||||
// Check internal PDF error
|
||||
if pdf.Error() != nil {
|
||||
return fmt.Errorf("font init failed: %w", pdf.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user