diff options
author | Kurt Jung <kurt.w.jung@code.google.com> | 2014-01-29 10:45:04 -0500 |
---|---|---|
committer | Kurt Jung <kurt.w.jung@code.google.com> | 2014-01-29 10:45:04 -0500 |
commit | 557587281695e882c2244eac363312bcac643240 (patch) | |
tree | d75e31d7b45e940e7453e4eb30ce2f2cba7250cf /def.go | |
parent | 85f9ff114702c1a4c9187762d8a7a7779c49f130 (diff) |
Factored basic SVG path rendering, basic HTML rendering, and color routines.
Diffstat (limited to 'def.go')
-rw-r--r-- | def.go | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Kurt Jung (Gmail: kurt.w.jung) + * Copyright (c) 2013-2014 Kurt Jung (Gmail: kurt.w.jung) * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -66,6 +66,14 @@ type ImageInfoType struct { scale float64 // document scaling factor } +// PointConvert returns the value of pt, expressed in points (1/72 inch), as a +// value expressed in the unit of measure specified in New(). Since font +// management in Fpdf uses points, this method can help with line height +// calculations and other methods that require user units. +func (f *Fpdf) PointConvert(pt float64) float64 { + return pt / f.k +} + // Extent returns the width and height of the image in the units of the Fpdf // object. func (info *ImageInfoType) Extent() (wd, ht float64) { @@ -157,10 +165,6 @@ type Fpdf struct { currentFont fontDefType // current font info fontSizePt float64 // current font size in points fontSize float64 // current font size in user unit - drawColor string // commands for drawing color - fillColor string // commands for filling color - textColor string // commands for text color - colorFlag bool // indicates whether fill and text colors are different ws float64 // word spacing images map[string]*ImageInfoType // array of used images pageLinks [][]linkType // pageLinks[page][link], both 1-based @@ -192,6 +196,10 @@ type Fpdf struct { clipNest int // Number of active clipping contexts transformNest int // Number of active transformation contexts err error // Set if error occurs during life cycle of instance + colorFlag bool // indicates whether fill and text colors are different + color struct { // Composite values of colors + draw, fill, text clrType + } } type encType struct { |