summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--doc.go3
-rw-r--r--fpdf.go12
-rw-r--r--fpdf_test.go4
4 files changed, 14 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index cde0305..78d0dfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ pdf.txt
*.sublime*
font/Ubuntu-*
*.0
+*.swp
diff --git a/doc.go b/doc.go
index 55ff390..8e3c0e1 100644
--- a/doc.go
+++ b/doc.go
@@ -71,7 +71,8 @@ Schroeder. Ivan Daniluk generalized the font and image loading code to use the
Reader interface while maintaining backward compatibility. Anthony Starks
provided code for the Polygon function. Robert Lillack provided the Beziergon
function and corrected some naming issues with the internal curve function.
-Bruno Michel has provided valuable assistance with the code.
+Claudio Felber provided implementations for dashed line drawing and generalized
+font loading. Bruno Michel has provided valuable assistance with the code.
The FPDF website is http://www.fpdf.org/.
diff --git a/fpdf.go b/fpdf.go
index b2872e6..e516931 100644
--- a/fpdf.go
+++ b/fpdf.go
@@ -788,10 +788,14 @@ func (f *Fpdf) SetLineCapStyle(styleStr string) {
}
}
-// SetDashPattern sets the dash pattern that is used to draw lines.
-// The dashArray elements are numbers that specify the lengths of alternating
-// dashes and gaps. The dash phase specifies the distance into the dash pattern
-// at which to start the dash. The dash pattern is retained from page to page.
+// SetDashPattern sets the dash pattern that is used to draw lines. The
+// dashArray elements are numbers, in units established in New(), that specify
+// the lengths of alternating dashes and gaps. The dash phase specifies the
+// distance into the dash pattern at which to start the dash. The dash pattern
+// is retained from page to page. Call this method with an empty array to
+// restore solid line drawing.
+//
+// See tutorial 28 for an example of this function.
func (f *Fpdf) SetDashPattern(dashArray []float64, dashPhase float64) {
scaled := make([]float64, len(dashArray))
for i, value := range dashArray {
diff --git a/fpdf_test.go b/fpdf_test.go
index f8df0c3..bb69569 100644
--- a/fpdf_test.go
+++ b/fpdf_test.go
@@ -1415,8 +1415,10 @@ func ExampleFpdf_tutorial28() {
srcPrev = src
}
pdf.MultiCell(wd-margin-margin, ln, msgStr, "", "C", false)
- pdf.SetDrawColor(224, 224, 224)
+ pdf.SetDashPattern([]float64{0.8, 0.8}, 0)
+ pdf.SetDrawColor(160, 160, 160)
pdf.Polygon(srcList, "D")
+ pdf.SetDashPattern([]float64{}, 0)
pdf.SetDrawColor(64, 64, 128)
pdf.SetLineWidth(pdf.GetLineWidth() * 3)
pdf.Beziergon(curveList, "D")