From 3b6661f37138ca3acd19fdf756b3104021d2b315 Mon Sep 17 00:00:00 2001 From: Paulo Coutinho Date: Thu, 28 Jul 2016 15:16:40 -0300 Subject: adding support to embedded fonts as byte array --- def.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'def.go') diff --git a/def.go b/def.go index f5eed3a..3bb32d4 100644 --- a/def.go +++ b/def.go @@ -122,6 +122,8 @@ func (info *ImageInfoType) SetDpi(dpi float64) { type fontFileType struct { length1, length2 int64 n int + embedded bool + content []byte } type linkType struct { @@ -246,9 +248,10 @@ type Fpdf struct { layer layerRecType // manages optional layers in document catalogSort bool // sort resource catalogs in document colorFlag bool // indicates whether fill and text colors are different - color struct { // Composite values of colors - draw, fill, text clrType - } + color struct { + // Composite values of colors + draw, fill, text clrType + } } type encType struct { @@ -310,31 +313,31 @@ type FontDescType struct { // The maximum height above the baseline reached by glyphs in this // font (for example for "S"). The height of glyphs for accented // characters shall be excluded. - Ascent int + Ascent int // The maximum depth below the baseline reached by glyphs in this // font. The value shall be a negative number. - Descent int + Descent int // The vertical coordinate of the top of flat capital letters, // measured from the baseline (for example "H"). - CapHeight int + CapHeight int // A collection of flags defining various characteristics of the // font. (See the FontFlag* constants.) - Flags int + Flags int // A rectangle, expressed in the glyph coordinate system, that // shall specify the font bounding box. This should be the smallest // rectangle enclosing the shape that would result if all of the // glyphs of the font were placed with their origins coincident // and then filled. - FontBBox fontBoxType + FontBBox fontBoxType // The angle, expressed in degrees counterclockwise from the // vertical, of the dominant vertical strokes of the font. (The // 9-o’clock position is 90 degrees, and the 3-o’clock position // is –90 degrees.) The value shall be negative for fonts that // slope to the right, as almost all italic fonts do. - ItalicAngle int + ItalicAngle int // The thickness, measured horizontally, of the dominant vertical // stems of glyphs in the font. - StemV int + StemV int // The width to use for character codes whose widths are not // specified in a font dictionary’s Widths array. This shall have // a predictable effect only if all such codes map to glyphs whose -- cgit v1.2.1-24-ge1ad From a7290bf6598b103a0fcdb5ce25182e83c00e881b Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 30 Jul 2016 11:04:43 -0400 Subject: Isolate embedded font data --- def.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'def.go') diff --git a/def.go b/def.go index 3bb32d4..54abbd1 100644 --- a/def.go +++ b/def.go @@ -249,9 +249,9 @@ type Fpdf struct { catalogSort bool // sort resource catalogs in document colorFlag bool // indicates whether fill and text colors are different color struct { - // Composite values of colors - draw, fill, text clrType - } + // Composite values of colors + draw, fill, text clrType + } } type encType struct { @@ -313,31 +313,31 @@ type FontDescType struct { // The maximum height above the baseline reached by glyphs in this // font (for example for "S"). The height of glyphs for accented // characters shall be excluded. - Ascent int + Ascent int // The maximum depth below the baseline reached by glyphs in this // font. The value shall be a negative number. - Descent int + Descent int // The vertical coordinate of the top of flat capital letters, // measured from the baseline (for example "H"). - CapHeight int + CapHeight int // A collection of flags defining various characteristics of the // font. (See the FontFlag* constants.) - Flags int + Flags int // A rectangle, expressed in the glyph coordinate system, that // shall specify the font bounding box. This should be the smallest // rectangle enclosing the shape that would result if all of the // glyphs of the font were placed with their origins coincident // and then filled. - FontBBox fontBoxType + FontBBox fontBoxType // The angle, expressed in degrees counterclockwise from the // vertical, of the dominant vertical strokes of the font. (The // 9-o’clock position is 90 degrees, and the 3-o’clock position // is –90 degrees.) The value shall be negative for fonts that // slope to the right, as almost all italic fonts do. - ItalicAngle int + ItalicAngle int // The thickness, measured horizontally, of the dominant vertical // stems of glyphs in the font. - StemV int + StemV int // The width to use for character codes whose widths are not // specified in a font dictionary’s Widths array. This shall have // a predictable effect only if all such codes map to glyphs whose -- cgit v1.2.1-24-ge1ad