From 0d6a38d49d631da305a6f17704f06f35c36cbddc Mon Sep 17 00:00:00 2001 From: DarkFreedman Date: Fri, 19 Apr 2019 17:00:39 +0300 Subject: Added full support for UTF-8 font. With MIT license. --- def.go | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'def.go') diff --git a/def.go b/def.go index fcc9237..4c46d03 100644 --- a/def.go +++ b/def.go @@ -266,6 +266,7 @@ type fontFileType struct { n int embedded bool content []byte + fontType string } type linkType struct { @@ -495,6 +496,7 @@ type PageBox struct { // Fpdf is the principal structure for creating a single PDF document type Fpdf struct { + isCurrentUTF8 bool // is current font used in utf-8 mode page int // current page number n int // current object number offsets []int // array of object offsets @@ -682,20 +684,22 @@ type FontDescType struct { } type fontDefType struct { - Tp string // "Core", "TrueType", ... - Name string // "Courier-Bold", ... - Desc FontDescType // Font descriptor - Up int // Underline position - Ut int // Underline thickness - Cw [256]int // Character width by ordinal - Enc string // "cp1252", ... - Diff string // Differences from reference encoding - File string // "Redressed.z" - Size1, Size2 int // Type1 values - OriginalSize int // Size of uncompressed font file - N int // Set by font loader - DiffN int // Position of diff in app array, set by font loader - i string // 1-based position in font list, set by font loader, not this program + Tp string // "Core", "TrueType", ... + Name string // "Courier-Bold", ... + Desc FontDescType // Font descriptor + Up int // Underline position + Ut int // Underline thickness + Cw []int // Character width by ordinal + Enc string // "cp1252", ... + Diff string // Differences from reference encoding + File string // "Redressed.z" + Size1, Size2 int // Type1 values + OriginalSize int // Size of uncompressed font file + N int // Set by font loader + DiffN int // Position of diff in app array, set by font loader + i string // 1-based position in font list, set by font loader, not this program + utf8File *utf8FontFile // UTF-8 font + usedRunes map[int]int // Array of used runes } // generateFontID generates a font Id from the font definition @@ -715,7 +719,7 @@ type fontInfoType struct { IsFixedPitch bool UnderlineThickness int UnderlinePosition int - Widths [256]int + Widths []int Size1, Size2 uint32 Desc FontDescType } -- cgit v1.2.1-24-ge1ad From 8022e9b91aea9cdbf7f7c561fc59a6e291cbfa59 Mon Sep 17 00:00:00 2001 From: DarkFreedman Date: Mon, 6 May 2019 13:23:42 +0300 Subject: Added copyrights. And "right to left" languages support. --- def.go | 1 + 1 file changed, 1 insertion(+) (limited to 'def.go') diff --git a/def.go b/def.go index 4c46d03..205389b 100644 --- a/def.go +++ b/def.go @@ -497,6 +497,7 @@ type PageBox struct { // Fpdf is the principal structure for creating a single PDF document type Fpdf struct { isCurrentUTF8 bool // is current font used in utf-8 mode + isRTL bool // is is right to left mode enabled page int // current page number n int // current object number offsets []int // array of object offsets -- cgit v1.2.1-24-ge1ad