From 557587281695e882c2244eac363312bcac643240 Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Wed, 29 Jan 2014 10:45:04 -0500 Subject: Factored basic SVG path rendering, basic HTML rendering, and color routines. --- def.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'def.go') diff --git a/def.go b/def.go index bf78fea..15e6939 100644 --- a/def.go +++ b/def.go @@ -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 { -- cgit v1.2.1-24-ge1ad