id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
21,800
jung-kurt/gofpdf
fpdf.go
point
func (f *Fpdf) point(x, y float64) { f.outf("%.2f %.2f m", x*f.k, (f.h-y)*f.k) }
go
func (f *Fpdf) point(x, y float64) { f.outf("%.2f %.2f m", x*f.k, (f.h-y)*f.k) }
[ "func", "(", "f", "*", "Fpdf", ")", "point", "(", "x", ",", "y", "float64", ")", "{", "f", ".", "outf", "(", "\"", "\"", ",", "x", "*", "f", ".", "k", ",", "(", "f", ".", "h", "-", "y", ")", "*", "f", ".", "k", ")", "\n", "}" ]
// point outputs current point
[ "point", "outputs", "current", "point" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L1148-L1150
21,801
jung-kurt/gofpdf
fpdf.go
GetAlpha
func (f *Fpdf) GetAlpha() (alpha float64, blendModeStr string) { return f.alpha, f.blendMode }
go
func (f *Fpdf) GetAlpha() (alpha float64, blendModeStr string) { return f.alpha, f.blendMode }
[ "func", "(", "f", "*", "Fpdf", ")", "GetAlpha", "(", ")", "(", "alpha", "float64", ",", "blendModeStr", "string", ")", "{", "return", "f", ".", "alpha", ",", "f", ".", "blendMode", "\n", "}" ]
// GetAlpha returns the alpha blending channel, which consists of the // alpha transparency value and the blend mode. See SetAlpha for more // details.
[ "GetAlpha", "returns", "the", "alpha", "blending", "channel", "which", "consists", "of", "the", "alpha", "transparency", "value", "and", "the", "blend", "mode", ".", "See", "SetAlpha", "for", "more", "details", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L1231-L1233
21,802
jung-kurt/gofpdf
fpdf.go
getFontKey
func getFontKey(familyStr, styleStr string) string { familyStr = strings.ToLower(familyStr) styleStr = strings.ToUpper(styleStr) if styleStr == "IB" { styleStr = "BI" } return familyStr + styleStr }
go
func getFontKey(familyStr, styleStr string) string { familyStr = strings.ToLower(familyStr) styleStr = strings.ToUpper(styleStr) if styleStr == "IB" { styleStr = "BI" } return familyStr + styleStr }
[ "func", "getFontKey", "(", "familyStr", ",", "styleStr", "string", ")", "string", "{", "familyStr", "=", "strings", ".", "ToLower", "(", "familyStr", ")", "\n", "styleStr", "=", "strings", ".", "ToUpper", "(", "styleStr", ")", "\n", "if", "styleStr", "==",...
// getFontKey is used by AddFontFromReader and GetFontDesc
[ "getFontKey", "is", "used", "by", "AddFontFromReader", "and", "GetFontDesc" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L1638-L1645
21,803
jung-kurt/gofpdf
fpdf.go
AddFontFromReader
func (f *Fpdf) AddFontFromReader(familyStr, styleStr string, r io.Reader) { if f.err != nil { return } // dbg("Adding family [%s], style [%s]", familyStr, styleStr) var ok bool fontkey := getFontKey(familyStr, styleStr) _, ok = f.fonts[fontkey] if ok { return } var info fontDefType info = f.loadfont(r) i...
go
func (f *Fpdf) AddFontFromReader(familyStr, styleStr string, r io.Reader) { if f.err != nil { return } // dbg("Adding family [%s], style [%s]", familyStr, styleStr) var ok bool fontkey := getFontKey(familyStr, styleStr) _, ok = f.fonts[fontkey] if ok { return } var info fontDefType info = f.loadfont(r) i...
[ "func", "(", "f", "*", "Fpdf", ")", "AddFontFromReader", "(", "familyStr", ",", "styleStr", "string", ",", "r", "io", ".", "Reader", ")", "{", "if", "f", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "// dbg(\"Adding family [%s], style [%s]\", f...
// AddFontFromReader imports a TrueType, OpenType or Type1 font and makes it // available using a reader that satisifies the io.Reader interface. See // AddFont for details about familyStr and styleStr.
[ "AddFontFromReader", "imports", "a", "TrueType", "OpenType", "or", "Type1", "font", "and", "makes", "it", "available", "using", "a", "reader", "that", "satisifies", "the", "io", ".", "Reader", "interface", ".", "See", "AddFont", "for", "details", "about", "fam...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L1650-L1692
21,804
jung-kurt/gofpdf
fpdf.go
GetFontDesc
func (f *Fpdf) GetFontDesc(familyStr, styleStr string) FontDescType { if familyStr == "" { return f.currentFont.Desc } return f.fonts[getFontKey(familyStr, styleStr)].Desc }
go
func (f *Fpdf) GetFontDesc(familyStr, styleStr string) FontDescType { if familyStr == "" { return f.currentFont.Desc } return f.fonts[getFontKey(familyStr, styleStr)].Desc }
[ "func", "(", "f", "*", "Fpdf", ")", "GetFontDesc", "(", "familyStr", ",", "styleStr", "string", ")", "FontDescType", "{", "if", "familyStr", "==", "\"", "\"", "{", "return", "f", ".", "currentFont", ".", "Desc", "\n", "}", "\n", "return", "f", ".", "...
// GetFontDesc returns the font descriptor, which can be used for // example to find the baseline of a font. If familyStr is empty // current font descriptor will be returned. // See FontDescType for documentation about the font descriptor. // See AddFont for details about familyStr and styleStr.
[ "GetFontDesc", "returns", "the", "font", "descriptor", "which", "can", "be", "used", "for", "example", "to", "find", "the", "baseline", "of", "a", "font", ".", "If", "familyStr", "is", "empty", "current", "font", "descriptor", "will", "be", "returned", ".", ...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L1699-L1704
21,805
jung-kurt/gofpdf
fpdf.go
newLink
func (f *Fpdf) newLink(x, y, w, h float64, link int, linkStr string) { // linkList, ok := f.pageLinks[f.page] // if !ok { // linkList = make([]linkType, 0, 8) // f.pageLinks[f.page] = linkList // } f.pageLinks[f.page] = append(f.pageLinks[f.page], linkType{x * f.k, f.hPt - y*f.k, w * f.k, h * f.k, link, linkStr...
go
func (f *Fpdf) newLink(x, y, w, h float64, link int, linkStr string) { // linkList, ok := f.pageLinks[f.page] // if !ok { // linkList = make([]linkType, 0, 8) // f.pageLinks[f.page] = linkList // } f.pageLinks[f.page] = append(f.pageLinks[f.page], linkType{x * f.k, f.hPt - y*f.k, w * f.k, h * f.k, link, linkStr...
[ "func", "(", "f", "*", "Fpdf", ")", "newLink", "(", "x", ",", "y", ",", "w", ",", "h", "float64", ",", "link", "int", ",", "linkStr", "string", ")", "{", "// linkList, ok := f.pageLinks[f.page]", "// if !ok {", "// linkList = make([]linkType, 0, 8)", "// f.pageL...
// newLink adds a new clickable link on current page
[ "newLink", "adds", "a", "new", "clickable", "link", "on", "current", "page" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L1855-L1863
21,806
jung-kurt/gofpdf
fpdf.go
Bookmark
func (f *Fpdf) Bookmark(txtStr string, level int, y float64) { if y == -1 { y = f.y } f.outlines = append(f.outlines, outlineType{text: txtStr, level: level, y: y, p: f.PageNo(), prev: -1, last: -1, next: -1, first: -1}) }
go
func (f *Fpdf) Bookmark(txtStr string, level int, y float64) { if y == -1 { y = f.y } f.outlines = append(f.outlines, outlineType{text: txtStr, level: level, y: y, p: f.PageNo(), prev: -1, last: -1, next: -1, first: -1}) }
[ "func", "(", "f", "*", "Fpdf", ")", "Bookmark", "(", "txtStr", "string", ",", "level", "int", ",", "y", "float64", ")", "{", "if", "y", "==", "-", "1", "{", "y", "=", "f", ".", "y", "\n", "}", "\n", "f", ".", "outlines", "=", "append", "(", ...
// Bookmark sets a bookmark that will be displayed in a sidebar outline. txtStr // is the title of the bookmark. level specifies the level of the bookmark in // the outline; 0 is the top level, 1 is just below, and so on. y specifies the // vertical position of the bookmark destination in the current page; -1 // indica...
[ "Bookmark", "sets", "a", "bookmark", "that", "will", "be", "displayed", "in", "a", "sidebar", "outline", ".", "txtStr", "is", "the", "title", "of", "the", "bookmark", ".", "level", "specifies", "the", "level", "of", "the", "bookmark", "in", "the", "outline...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L1886-L1891
21,807
jung-kurt/gofpdf
fpdf.go
Cell
func (f *Fpdf) Cell(w, h float64, txtStr string) { f.CellFormat(w, h, txtStr, "", 0, "L", false, 0, "") }
go
func (f *Fpdf) Cell(w, h float64, txtStr string) { f.CellFormat(w, h, txtStr, "", 0, "L", false, 0, "") }
[ "func", "(", "f", "*", "Fpdf", ")", "Cell", "(", "w", ",", "h", "float64", ",", "txtStr", "string", ")", "{", "f", ".", "CellFormat", "(", "w", ",", "h", ",", "txtStr", ",", "\"", "\"", ",", "0", ",", "\"", "\"", ",", "false", ",", "0", ","...
// Cell is a simpler version of CellFormat with no fill, border, links or // special alignment.
[ "Cell", "is", "a", "simpler", "version", "of", "CellFormat", "with", "no", "fill", "border", "links", "or", "special", "alignment", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2114-L2116
21,808
jung-kurt/gofpdf
fpdf.go
Cellf
func (f *Fpdf) Cellf(w, h float64, fmtStr string, args ...interface{}) { f.CellFormat(w, h, sprintf(fmtStr, args...), "", 0, "L", false, 0, "") }
go
func (f *Fpdf) Cellf(w, h float64, fmtStr string, args ...interface{}) { f.CellFormat(w, h, sprintf(fmtStr, args...), "", 0, "L", false, 0, "") }
[ "func", "(", "f", "*", "Fpdf", ")", "Cellf", "(", "w", ",", "h", "float64", ",", "fmtStr", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "f", ".", "CellFormat", "(", "w", ",", "h", ",", "sprintf", "(", "fmtStr", ",", "args", "....
// Cellf is a simpler printf-style version of CellFormat with no fill, border, // links or special alignment. See documentation for the fmt package for // details on fmtStr and args.
[ "Cellf", "is", "a", "simpler", "printf", "-", "style", "version", "of", "CellFormat", "with", "no", "fill", "border", "links", "or", "special", "alignment", ".", "See", "documentation", "for", "the", "fmt", "package", "for", "details", "on", "fmtStr", "and",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2121-L2123
21,809
jung-kurt/gofpdf
fpdf.go
SplitLines
func (f *Fpdf) SplitLines(txt []byte, w float64) [][]byte { // Function contributed by Bruno Michel lines := [][]byte{} cw := &f.currentFont.Cw wmax := int(math.Ceil((w - 2*f.cMargin) * 1000 / f.fontSize)) s := bytes.Replace(txt, []byte("\r"), []byte{}, -1) nb := len(s) for nb > 0 && s[nb-1] == '\n' { nb-- } ...
go
func (f *Fpdf) SplitLines(txt []byte, w float64) [][]byte { // Function contributed by Bruno Michel lines := [][]byte{} cw := &f.currentFont.Cw wmax := int(math.Ceil((w - 2*f.cMargin) * 1000 / f.fontSize)) s := bytes.Replace(txt, []byte("\r"), []byte{}, -1) nb := len(s) for nb > 0 && s[nb-1] == '\n' { nb-- } ...
[ "func", "(", "f", "*", "Fpdf", ")", "SplitLines", "(", "txt", "[", "]", "byte", ",", "w", "float64", ")", "[", "]", "[", "]", "byte", "{", "// Function contributed by Bruno Michel", "lines", ":=", "[", "]", "[", "]", "byte", "{", "}", "\n", "cw", "...
// SplitLines splits text into several lines using the current font. Each line // has its length limited to a maximum width given by w. This function can be // used to determine the total height of wrapped text for vertical placement // purposes. // // You can use MultiCell if you want to print a text on several lines ...
[ "SplitLines", "splits", "text", "into", "several", "lines", "using", "the", "current", "font", ".", "Each", "line", "has", "its", "length", "limited", "to", "a", "maximum", "width", "given", "by", "w", ".", "This", "function", "can", "be", "used", "to", ...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2132-L2174
21,810
jung-kurt/gofpdf
fpdf.go
write
func (f *Fpdf) write(h float64, txtStr string, link int, linkStr string) { // dbg("Write") cw := &f.currentFont.Cw w := f.w - f.rMargin - f.x wmax := (w - 2*f.cMargin) * 1000 / f.fontSize s := strings.Replace(txtStr, "\r", "", -1) nb := len(s) sep := -1 i := 0 j := 0 l := 0.0 nl := 1 for i < nb { // Get n...
go
func (f *Fpdf) write(h float64, txtStr string, link int, linkStr string) { // dbg("Write") cw := &f.currentFont.Cw w := f.w - f.rMargin - f.x wmax := (w - 2*f.cMargin) * 1000 / f.fontSize s := strings.Replace(txtStr, "\r", "", -1) nb := len(s) sep := -1 i := 0 j := 0 l := 0.0 nl := 1 for i < nb { // Get n...
[ "func", "(", "f", "*", "Fpdf", ")", "write", "(", "h", "float64", ",", "txtStr", "string", ",", "link", "int", ",", "linkStr", "string", ")", "{", "// dbg(\"Write\")", "cw", ":=", "&", "f", ".", "currentFont", ".", "Cw", "\n", "w", ":=", "f", ".", ...
// write outputs text in flowing mode
[ "write", "outputs", "text", "in", "flowing", "mode" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2312-L2384
21,811
jung-kurt/gofpdf
fpdf.go
Writef
func (f *Fpdf) Writef(h float64, fmtStr string, args ...interface{}) { f.write(h, sprintf(fmtStr, args...), 0, "") }
go
func (f *Fpdf) Writef(h float64, fmtStr string, args ...interface{}) { f.write(h, sprintf(fmtStr, args...), 0, "") }
[ "func", "(", "f", "*", "Fpdf", ")", "Writef", "(", "h", "float64", ",", "fmtStr", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "f", ".", "write", "(", "h", ",", "sprintf", "(", "fmtStr", ",", "args", "...", ")", ",", "0", ",",...
// Writef is like Write but uses printf-style formatting. See the documentation // for package fmt for more details on fmtStr and args.
[ "Writef", "is", "like", "Write", "but", "uses", "printf", "-", "style", "formatting", ".", "See", "the", "documentation", "for", "package", "fmt", "for", "more", "details", "on", "fmtStr", "and", "args", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2400-L2402
21,812
jung-kurt/gofpdf
fpdf.go
Ln
func (f *Fpdf) Ln(h float64) { f.x = f.lMargin if h < 0 { f.y += f.lasth } else { f.y += h } }
go
func (f *Fpdf) Ln(h float64) { f.x = f.lMargin if h < 0 { f.y += f.lasth } else { f.y += h } }
[ "func", "(", "f", "*", "Fpdf", ")", "Ln", "(", "h", "float64", ")", "{", "f", ".", "x", "=", "f", ".", "lMargin", "\n", "if", "h", "<", "0", "{", "f", ".", "y", "+=", "f", ".", "lasth", "\n", "}", "else", "{", "f", ".", "y", "+=", "h", ...
// Ln performs a line break. The current abscissa goes back to the left margin // and the ordinate increases by the amount passed in parameter. A negative // value of h indicates the height of the last printed cell. // // This method is demonstrated in the example for MultiCell.
[ "Ln", "performs", "a", "line", "break", ".", "The", "current", "abscissa", "goes", "back", "to", "the", "left", "margin", "and", "the", "ordinate", "increases", "by", "the", "amount", "passed", "in", "parameter", ".", "A", "negative", "value", "of", "h", ...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2463-L2470
21,813
jung-kurt/gofpdf
fpdf.go
RegisterImageReader
func (f *Fpdf) RegisterImageReader(imgName, tp string, r io.Reader) (info *ImageInfoType) { options := ImageOptions{ ReadDpi: false, ImageType: tp, } return f.RegisterImageOptionsReader(imgName, options, r) }
go
func (f *Fpdf) RegisterImageReader(imgName, tp string, r io.Reader) (info *ImageInfoType) { options := ImageOptions{ ReadDpi: false, ImageType: tp, } return f.RegisterImageOptionsReader(imgName, options, r) }
[ "func", "(", "f", "*", "Fpdf", ")", "RegisterImageReader", "(", "imgName", ",", "tp", "string", ",", "r", "io", ".", "Reader", ")", "(", "info", "*", "ImageInfoType", ")", "{", "options", ":=", "ImageOptions", "{", "ReadDpi", ":", "false", ",", "ImageT...
// RegisterImageReader registers an image, reading it from Reader r, adding it // to the PDF file but not adding it to the page. // // This function is now deprecated in favor of RegisterImageOptionsReader
[ "RegisterImageReader", "registers", "an", "image", "reading", "it", "from", "Reader", "r", "adding", "it", "to", "the", "PDF", "file", "but", "not", "adding", "it", "to", "the", "page", ".", "This", "function", "is", "now", "deprecated", "in", "favor", "of...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2612-L2618
21,814
jung-kurt/gofpdf
fpdf.go
GetImageInfo
func (f *Fpdf) GetImageInfo(imageStr string) (info *ImageInfoType) { return f.images[imageStr] }
go
func (f *Fpdf) GetImageInfo(imageStr string) (info *ImageInfoType) { return f.images[imageStr] }
[ "func", "(", "f", "*", "Fpdf", ")", "GetImageInfo", "(", "imageStr", "string", ")", "(", "info", "*", "ImageInfoType", ")", "{", "return", "f", ".", "images", "[", "imageStr", "]", "\n", "}" ]
// GetImageInfo returns information about the registered image specified by // imageStr. If the image has not been registered, nil is returned. The // internal error is not modified by this method.
[ "GetImageInfo", "returns", "information", "about", "the", "registered", "image", "specified", "by", "imageStr", ".", "If", "the", "image", "has", "not", "been", "registered", "nil", "is", "returned", ".", "The", "internal", "error", "is", "not", "modified", "b...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2737-L2739
21,815
jung-kurt/gofpdf
fpdf.go
SetX
func (f *Fpdf) SetX(x float64) { if x >= 0 { f.x = x } else { f.x = f.w + x } }
go
func (f *Fpdf) SetX(x float64) { if x >= 0 { f.x = x } else { f.x = f.w + x } }
[ "func", "(", "f", "*", "Fpdf", ")", "SetX", "(", "x", "float64", ")", "{", "if", "x", ">=", "0", "{", "f", ".", "x", "=", "x", "\n", "}", "else", "{", "f", ".", "x", "=", "f", ".", "w", "+", "x", "\n", "}", "\n", "}" ]
// SetX defines the abscissa of the current position. If the passed value is // negative, it is relative to the right of the page.
[ "SetX", "defines", "the", "abscissa", "of", "the", "current", "position", ".", "If", "the", "passed", "value", "is", "negative", "it", "is", "relative", "to", "the", "right", "of", "the", "page", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2768-L2774
21,816
jung-kurt/gofpdf
fpdf.go
SetY
func (f *Fpdf) SetY(y float64) { // dbg("SetY x %.2f, lMargin %.2f", f.x, f.lMargin) f.x = f.lMargin if y >= 0 { f.y = y } else { f.y = f.h + y } }
go
func (f *Fpdf) SetY(y float64) { // dbg("SetY x %.2f, lMargin %.2f", f.x, f.lMargin) f.x = f.lMargin if y >= 0 { f.y = y } else { f.y = f.h + y } }
[ "func", "(", "f", "*", "Fpdf", ")", "SetY", "(", "y", "float64", ")", "{", "// dbg(\"SetY x %.2f, lMargin %.2f\", f.x, f.lMargin)", "f", ".", "x", "=", "f", ".", "lMargin", "\n", "if", "y", ">=", "0", "{", "f", ".", "y", "=", "y", "\n", "}", "else", ...
// SetY moves the current abscissa back to the left margin and sets the // ordinate. If the passed value is negative, it is relative to the bottom of // the page.
[ "SetY", "moves", "the", "current", "abscissa", "back", "to", "the", "left", "margin", "and", "sets", "the", "ordinate", ".", "If", "the", "passed", "value", "is", "negative", "it", "is", "relative", "to", "the", "bottom", "of", "the", "page", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2784-L2792
21,817
jung-kurt/gofpdf
fpdf.go
SetHomeXY
func (f *Fpdf) SetHomeXY() { f.SetY(f.tMargin) f.SetX(f.lMargin) }
go
func (f *Fpdf) SetHomeXY() { f.SetY(f.tMargin) f.SetX(f.lMargin) }
[ "func", "(", "f", "*", "Fpdf", ")", "SetHomeXY", "(", ")", "{", "f", ".", "SetY", "(", "f", ".", "tMargin", ")", "\n", "f", ".", "SetX", "(", "f", ".", "lMargin", ")", "\n", "}" ]
// SetHomeXY is a convenience method that sets the current position to the left // and top margins.
[ "SetHomeXY", "is", "a", "convenience", "method", "that", "sets", "the", "current", "position", "to", "the", "left", "and", "top", "margins", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2796-L2799
21,818
jung-kurt/gofpdf
fpdf.go
SetXY
func (f *Fpdf) SetXY(x, y float64) { f.SetY(y) f.SetX(x) }
go
func (f *Fpdf) SetXY(x, y float64) { f.SetY(y) f.SetX(x) }
[ "func", "(", "f", "*", "Fpdf", ")", "SetXY", "(", "x", ",", "y", "float64", ")", "{", "f", ".", "SetY", "(", "y", ")", "\n", "f", ".", "SetX", "(", "x", ")", "\n", "}" ]
// SetXY defines the abscissa and ordinate of the current position. If the // passed values are negative, they are relative respectively to the right and // bottom of the page.
[ "SetXY", "defines", "the", "abscissa", "and", "ordinate", "of", "the", "current", "position", ".", "If", "the", "passed", "values", "are", "negative", "they", "are", "relative", "respectively", "to", "the", "right", "and", "bottom", "of", "the", "page", "." ...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2804-L2807
21,819
jung-kurt/gofpdf
fpdf.go
SetProtection
func (f *Fpdf) SetProtection(actionFlag byte, userPassStr, ownerPassStr string) { if f.err != nil { return } f.protect.setProtection(actionFlag, userPassStr, ownerPassStr) }
go
func (f *Fpdf) SetProtection(actionFlag byte, userPassStr, ownerPassStr string) { if f.err != nil { return } f.protect.setProtection(actionFlag, userPassStr, ownerPassStr) }
[ "func", "(", "f", "*", "Fpdf", ")", "SetProtection", "(", "actionFlag", "byte", ",", "userPassStr", ",", "ownerPassStr", "string", ")", "{", "if", "f", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "f", ".", "protect", ".", "setProtection", ...
// SetProtection applies certain constraints on the finished PDF document. // // actionFlag is a bitflag that controls various document operations. // CnProtectPrint allows the document to be printed. CnProtectModify allows a // document to be modified by a PDF editor. CnProtectCopy allows text and // images to be copi...
[ "SetProtection", "applies", "certain", "constraints", "on", "the", "finished", "PDF", "document", ".", "actionFlag", "is", "a", "bitflag", "that", "controls", "various", "document", "operations", ".", "CnProtectPrint", "allows", "the", "document", "to", "be", "pri...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2827-L2832
21,820
jung-kurt/gofpdf
fpdf.go
OutputAndClose
func (f *Fpdf) OutputAndClose(w io.WriteCloser) error { f.Output(w) w.Close() return f.err }
go
func (f *Fpdf) OutputAndClose(w io.WriteCloser) error { f.Output(w) w.Close() return f.err }
[ "func", "(", "f", "*", "Fpdf", ")", "OutputAndClose", "(", "w", "io", ".", "WriteCloser", ")", "error", "{", "f", ".", "Output", "(", "w", ")", "\n", "w", ".", "Close", "(", ")", "\n", "return", "f", ".", "err", "\n", "}" ]
// OutputAndClose sends the PDF document to the writer specified by w. This // method will close both f and w, even if an error is detected and no document // is produced.
[ "OutputAndClose", "sends", "the", "PDF", "document", "to", "the", "writer", "specified", "by", "w", ".", "This", "method", "will", "close", "both", "f", "and", "w", "even", "if", "an", "error", "is", "detected", "and", "no", "document", "is", "produced", ...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2837-L2841
21,821
jung-kurt/gofpdf
fpdf.go
OutputFileAndClose
func (f *Fpdf) OutputFileAndClose(fileStr string) error { if f.err == nil { pdfFile, err := os.Create(fileStr) if err == nil { f.Output(pdfFile) pdfFile.Close() } else { f.err = err } } return f.err }
go
func (f *Fpdf) OutputFileAndClose(fileStr string) error { if f.err == nil { pdfFile, err := os.Create(fileStr) if err == nil { f.Output(pdfFile) pdfFile.Close() } else { f.err = err } } return f.err }
[ "func", "(", "f", "*", "Fpdf", ")", "OutputFileAndClose", "(", "fileStr", "string", ")", "error", "{", "if", "f", ".", "err", "==", "nil", "{", "pdfFile", ",", "err", ":=", "os", ".", "Create", "(", "fileStr", ")", "\n", "if", "err", "==", "nil", ...
// OutputFileAndClose creates or truncates the file specified by fileStr and // writes the PDF document to it. This method will close f and the newly // written file, even if an error is detected and no document is produced. // // Most examples demonstrate the use of this method.
[ "OutputFileAndClose", "creates", "or", "truncates", "the", "file", "specified", "by", "fileStr", "and", "writes", "the", "PDF", "document", "to", "it", ".", "This", "method", "will", "close", "f", "and", "the", "newly", "written", "file", "even", "if", "an",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2848-L2859
21,822
jung-kurt/gofpdf
fpdf.go
Output
func (f *Fpdf) Output(w io.Writer) error { if f.err != nil { return f.err } // dbg("Output") if f.state < 3 { f.Close() } _, err := f.buffer.WriteTo(w) if err != nil { f.err = err } return f.err }
go
func (f *Fpdf) Output(w io.Writer) error { if f.err != nil { return f.err } // dbg("Output") if f.state < 3 { f.Close() } _, err := f.buffer.WriteTo(w) if err != nil { f.err = err } return f.err }
[ "func", "(", "f", "*", "Fpdf", ")", "Output", "(", "w", "io", ".", "Writer", ")", "error", "{", "if", "f", ".", "err", "!=", "nil", "{", "return", "f", ".", "err", "\n", "}", "\n", "// dbg(\"Output\")", "if", "f", ".", "state", "<", "3", "{", ...
// Output sends the PDF document to the writer specified by w. No output will // take place if an error has occurred in the document generation process. w // remains open after this function returns. After returning, f is in a closed // state and its methods should not be called.
[ "Output", "sends", "the", "PDF", "document", "to", "the", "writer", "specified", "by", "w", ".", "No", "output", "will", "take", "place", "if", "an", "error", "has", "occurred", "in", "the", "document", "generation", "process", ".", "w", "remains", "open",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2865-L2878
21,823
jung-kurt/gofpdf
fpdf.go
loadfont
func (f *Fpdf) loadfont(r io.Reader) (def fontDefType) { if f.err != nil { return } // dbg("Loading font [%s]", fontStr) var buf bytes.Buffer _, err := buf.ReadFrom(r) if err != nil { f.err = err return } err = json.Unmarshal(buf.Bytes(), &def) if err != nil { f.err = err return } if def.i, err = ...
go
func (f *Fpdf) loadfont(r io.Reader) (def fontDefType) { if f.err != nil { return } // dbg("Loading font [%s]", fontStr) var buf bytes.Buffer _, err := buf.ReadFrom(r) if err != nil { f.err = err return } err = json.Unmarshal(buf.Bytes(), &def) if err != nil { f.err = err return } if def.i, err = ...
[ "func", "(", "f", "*", "Fpdf", ")", "loadfont", "(", "r", "io", ".", "Reader", ")", "(", "def", "fontDefType", ")", "{", "if", "f", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "// dbg(\"Loading font [%s]\", fontStr)", "var", "buf", "bytes"...
// Load a font definition file from the given Reader
[ "Load", "a", "font", "definition", "file", "from", "the", "given", "Reader" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2960-L2982
21,824
jung-kurt/gofpdf
fpdf.go
escape
func (f *Fpdf) escape(s string) string { s = strings.Replace(s, "\\", "\\\\", -1) s = strings.Replace(s, "(", "\\(", -1) s = strings.Replace(s, ")", "\\)", -1) s = strings.Replace(s, "\r", "\\r", -1) return s }
go
func (f *Fpdf) escape(s string) string { s = strings.Replace(s, "\\", "\\\\", -1) s = strings.Replace(s, "(", "\\(", -1) s = strings.Replace(s, ")", "\\)", -1) s = strings.Replace(s, "\r", "\\r", -1) return s }
[ "func", "(", "f", "*", "Fpdf", ")", "escape", "(", "s", "string", ")", "string", "{", "s", "=", "strings", ".", "Replace", "(", "s", ",", "\"", "\\\\", "\"", ",", "\"", "\\\\", "\\\\", "\"", ",", "-", "1", ")", "\n", "s", "=", "strings", ".",...
// Escape special characters in strings
[ "Escape", "special", "characters", "in", "strings" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2985-L2991
21,825
jung-kurt/gofpdf
fpdf.go
textstring
func (f *Fpdf) textstring(s string) string { if f.protect.encrypted { b := []byte(s) f.protect.rc4(uint32(f.n), &b) s = string(b) } return "(" + f.escape(s) + ")" }
go
func (f *Fpdf) textstring(s string) string { if f.protect.encrypted { b := []byte(s) f.protect.rc4(uint32(f.n), &b) s = string(b) } return "(" + f.escape(s) + ")" }
[ "func", "(", "f", "*", "Fpdf", ")", "textstring", "(", "s", "string", ")", "string", "{", "if", "f", ".", "protect", ".", "encrypted", "{", "b", ":=", "[", "]", "byte", "(", "s", ")", "\n", "f", ".", "protect", ".", "rc4", "(", "uint32", "(", ...
// textstring formats a text string
[ "textstring", "formats", "a", "text", "string" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L2994-L3001
21,826
jung-kurt/gofpdf
fpdf.go
parsejpg
func (f *Fpdf) parsejpg(r io.Reader) (info *ImageInfoType) { info = f.newImageInfo() var ( data bytes.Buffer err error ) _, err = data.ReadFrom(r) if err != nil { f.err = err return } info.data = data.Bytes() config, err := jpeg.DecodeConfig(bytes.NewReader(info.data)) if err != nil { f.err = err ...
go
func (f *Fpdf) parsejpg(r io.Reader) (info *ImageInfoType) { info = f.newImageInfo() var ( data bytes.Buffer err error ) _, err = data.ReadFrom(r) if err != nil { f.err = err return } info.data = data.Bytes() config, err := jpeg.DecodeConfig(bytes.NewReader(info.data)) if err != nil { f.err = err ...
[ "func", "(", "f", "*", "Fpdf", ")", "parsejpg", "(", "r", "io", ".", "Reader", ")", "(", "info", "*", "ImageInfoType", ")", "{", "info", "=", "f", ".", "newImageInfo", "(", ")", "\n", "var", "(", "data", "bytes", ".", "Buffer", "\n", "err", "erro...
// parsejpg extracts info from io.Reader with JPEG data // Thank you, Bruno Michel, for providing this code.
[ "parsejpg", "extracts", "info", "from", "io", ".", "Reader", "with", "JPEG", "data", "Thank", "you", "Bruno", "Michel", "for", "providing", "this", "code", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L3037-L3071
21,827
jung-kurt/gofpdf
fpdf.go
parsepng
func (f *Fpdf) parsepng(r io.Reader, readdpi bool) (info *ImageInfoType) { buf, err := bufferFromReader(r) if err != nil { f.err = err return } return f.parsepngstream(buf, readdpi) }
go
func (f *Fpdf) parsepng(r io.Reader, readdpi bool) (info *ImageInfoType) { buf, err := bufferFromReader(r) if err != nil { f.err = err return } return f.parsepngstream(buf, readdpi) }
[ "func", "(", "f", "*", "Fpdf", ")", "parsepng", "(", "r", "io", ".", "Reader", ",", "readdpi", "bool", ")", "(", "info", "*", "ImageInfoType", ")", "{", "buf", ",", "err", ":=", "bufferFromReader", "(", "r", ")", "\n", "if", "err", "!=", "nil", "...
// parsepng extracts info from a PNG data
[ "parsepng", "extracts", "info", "from", "a", "PNG", "data" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L3074-L3081
21,828
jung-kurt/gofpdf
fpdf.go
newobj
func (f *Fpdf) newobj() { // dbg("newobj") f.n++ for j := len(f.offsets); j <= f.n; j++ { f.offsets = append(f.offsets, 0) } f.offsets[f.n] = f.buffer.Len() f.outf("%d 0 obj", f.n) }
go
func (f *Fpdf) newobj() { // dbg("newobj") f.n++ for j := len(f.offsets); j <= f.n; j++ { f.offsets = append(f.offsets, 0) } f.offsets[f.n] = f.buffer.Len() f.outf("%d 0 obj", f.n) }
[ "func", "(", "f", "*", "Fpdf", ")", "newobj", "(", ")", "{", "// dbg(\"newobj\")", "f", ".", "n", "++", "\n", "for", "j", ":=", "len", "(", "f", ".", "offsets", ")", ";", "j", "<=", "f", ".", "n", ";", "j", "++", "{", "f", ".", "offsets", "...
// newobj begins a new object
[ "newobj", "begins", "a", "new", "object" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L3122-L3130
21,829
jung-kurt/gofpdf
fpdf.go
out
func (f *Fpdf) out(s string) { if f.state == 2 { f.pages[f.page].WriteString(s) f.pages[f.page].WriteString("\n") } else { f.buffer.WriteString(s) f.buffer.WriteString("\n") } }
go
func (f *Fpdf) out(s string) { if f.state == 2 { f.pages[f.page].WriteString(s) f.pages[f.page].WriteString("\n") } else { f.buffer.WriteString(s) f.buffer.WriteString("\n") } }
[ "func", "(", "f", "*", "Fpdf", ")", "out", "(", "s", "string", ")", "{", "if", "f", ".", "state", "==", "2", "{", "f", ".", "pages", "[", "f", ".", "page", "]", ".", "WriteString", "(", "s", ")", "\n", "f", ".", "pages", "[", "f", ".", "p...
// out; Add a line to the document
[ "out", ";", "Add", "a", "line", "to", "the", "document" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L3143-L3151
21,830
jung-kurt/gofpdf
fpdf.go
outbuf
func (f *Fpdf) outbuf(r io.Reader) { if f.state == 2 { f.pages[f.page].ReadFrom(r) f.pages[f.page].WriteString("\n") } else { f.buffer.ReadFrom(r) f.buffer.WriteString("\n") } }
go
func (f *Fpdf) outbuf(r io.Reader) { if f.state == 2 { f.pages[f.page].ReadFrom(r) f.pages[f.page].WriteString("\n") } else { f.buffer.ReadFrom(r) f.buffer.WriteString("\n") } }
[ "func", "(", "f", "*", "Fpdf", ")", "outbuf", "(", "r", "io", ".", "Reader", ")", "{", "if", "f", ".", "state", "==", "2", "{", "f", ".", "pages", "[", "f", ".", "page", "]", ".", "ReadFrom", "(", "r", ")", "\n", "f", ".", "pages", "[", "...
// outbuf adds a buffered line to the document
[ "outbuf", "adds", "a", "buffered", "line", "to", "the", "document" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L3154-L3162
21,831
jung-kurt/gofpdf
fpdf.go
outf
func (f *Fpdf) outf(fmtStr string, args ...interface{}) { f.out(sprintf(fmtStr, args...)) }
go
func (f *Fpdf) outf(fmtStr string, args ...interface{}) { f.out(sprintf(fmtStr, args...)) }
[ "func", "(", "f", "*", "Fpdf", ")", "outf", "(", "fmtStr", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "f", ".", "out", "(", "sprintf", "(", "fmtStr", ",", "args", "...", ")", ")", "\n", "}" ]
// outf adds a formatted line to the document
[ "outf", "adds", "a", "formatted", "line", "to", "the", "document" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/fpdf.go#L3181-L3183
21,832
jung-kurt/gofpdf
util.go
fileExist
func fileExist(filename string) (ok bool) { info, err := os.Stat(filename) if err == nil { if ^os.ModePerm&info.Mode() == 0 { ok = true } } return ok }
go
func fileExist(filename string) (ok bool) { info, err := os.Stat(filename) if err == nil { if ^os.ModePerm&info.Mode() == 0 { ok = true } } return ok }
[ "func", "fileExist", "(", "filename", "string", ")", "(", "ok", "bool", ")", "{", "info", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", "\n", "if", "err", "==", "nil", "{", "if", "^", "os", ".", "ModePerm", "&", "info", ".", "Mode", ...
// fileExist returns true if the specified normal file exists
[ "fileExist", "returns", "true", "if", "the", "specified", "normal", "file", "exists" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L43-L51
21,833
jung-kurt/gofpdf
util.go
fileSize
func fileSize(filename string) (size int64, ok bool) { info, err := os.Stat(filename) ok = err == nil if ok { size = info.Size() } return }
go
func fileSize(filename string) (size int64, ok bool) { info, err := os.Stat(filename) ok = err == nil if ok { size = info.Size() } return }
[ "func", "fileSize", "(", "filename", "string", ")", "(", "size", "int64", ",", "ok", "bool", ")", "{", "info", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", "\n", "ok", "=", "err", "==", "nil", "\n", "if", "ok", "{", "size", "=", "...
// fileSize returns the size of the specified file; ok will be false // if the file does not exist or is not an ordinary file
[ "fileSize", "returns", "the", "size", "of", "the", "specified", "file", ";", "ok", "will", "be", "false", "if", "the", "file", "does", "not", "exist", "or", "is", "not", "an", "ordinary", "file" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L55-L62
21,834
jung-kurt/gofpdf
util.go
bufferFromReader
func bufferFromReader(r io.Reader) (b *bytes.Buffer, err error) { b = new(bytes.Buffer) _, err = b.ReadFrom(r) return }
go
func bufferFromReader(r io.Reader) (b *bytes.Buffer, err error) { b = new(bytes.Buffer) _, err = b.ReadFrom(r) return }
[ "func", "bufferFromReader", "(", "r", "io", ".", "Reader", ")", "(", "b", "*", "bytes", ".", "Buffer", ",", "err", "error", ")", "{", "b", "=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "_", ",", "err", "=", "b", ".", "ReadFrom", "(", "r",...
// bufferFromReader returns a new buffer populated with the contents of the specified Reader
[ "bufferFromReader", "returns", "a", "new", "buffer", "populated", "with", "the", "contents", "of", "the", "specified", "Reader" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L65-L69
21,835
jung-kurt/gofpdf
util.go
slicesEqual
func slicesEqual(a, b []float64) bool { if len(a) != len(b) { return false } for i := range a { if a[i] != b[i] { return false } } return true }
go
func slicesEqual(a, b []float64) bool { if len(a) != len(b) { return false } for i := range a { if a[i] != b[i] { return false } } return true }
[ "func", "slicesEqual", "(", "a", ",", "b", "[", "]", "float64", ")", "bool", "{", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ":=", "range", "a", "{", "if", "a", "[", "i", "]"...
// slicesEqual returns true if the two specified float slices are equal
[ "slicesEqual", "returns", "true", "if", "the", "two", "specified", "float", "slices", "are", "equal" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L72-L82
21,836
jung-kurt/gofpdf
util.go
sliceCompress
func sliceCompress(data []byte) []byte { var buf bytes.Buffer cmp, _ := zlib.NewWriterLevel(&buf, zlib.BestSpeed) cmp.Write(data) cmp.Close() return buf.Bytes() }
go
func sliceCompress(data []byte) []byte { var buf bytes.Buffer cmp, _ := zlib.NewWriterLevel(&buf, zlib.BestSpeed) cmp.Write(data) cmp.Close() return buf.Bytes() }
[ "func", "sliceCompress", "(", "data", "[", "]", "byte", ")", "[", "]", "byte", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "cmp", ",", "_", ":=", "zlib", ".", "NewWriterLevel", "(", "&", "buf", ",", "zlib", ".", "BestSpeed", ")", "\n", "cmp", ...
// sliceCompress returns a zlib-compressed copy of the specified byte array
[ "sliceCompress", "returns", "a", "zlib", "-", "compressed", "copy", "of", "the", "specified", "byte", "array" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L85-L91
21,837
jung-kurt/gofpdf
util.go
sliceUncompress
func sliceUncompress(data []byte) (outData []byte, err error) { inBuf := bytes.NewReader(data) r, err := zlib.NewReader(inBuf) defer r.Close() if err == nil { var outBuf bytes.Buffer _, err = outBuf.ReadFrom(r) if err == nil { outData = outBuf.Bytes() } } return }
go
func sliceUncompress(data []byte) (outData []byte, err error) { inBuf := bytes.NewReader(data) r, err := zlib.NewReader(inBuf) defer r.Close() if err == nil { var outBuf bytes.Buffer _, err = outBuf.ReadFrom(r) if err == nil { outData = outBuf.Bytes() } } return }
[ "func", "sliceUncompress", "(", "data", "[", "]", "byte", ")", "(", "outData", "[", "]", "byte", ",", "err", "error", ")", "{", "inBuf", ":=", "bytes", ".", "NewReader", "(", "data", ")", "\n", "r", ",", "err", ":=", "zlib", ".", "NewReader", "(", ...
// sliceUncompress returns an uncompressed copy of the specified zlib-compressed byte array
[ "sliceUncompress", "returns", "an", "uncompressed", "copy", "of", "the", "specified", "zlib", "-", "compressed", "byte", "array" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L94-L106
21,838
jung-kurt/gofpdf
util.go
intIf
func intIf(cnd bool, a, b int) int { if cnd { return a } return b }
go
func intIf(cnd bool, a, b int) int { if cnd { return a } return b }
[ "func", "intIf", "(", "cnd", "bool", ",", "a", ",", "b", "int", ")", "int", "{", "if", "cnd", "{", "return", "a", "\n", "}", "\n", "return", "b", "\n", "}" ]
// intIf returns a if cnd is true, otherwise b
[ "intIf", "returns", "a", "if", "cnd", "is", "true", "otherwise", "b" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L141-L146
21,839
jung-kurt/gofpdf
util.go
strIf
func strIf(cnd bool, aStr, bStr string) string { if cnd { return aStr } return bStr }
go
func strIf(cnd bool, aStr, bStr string) string { if cnd { return aStr } return bStr }
[ "func", "strIf", "(", "cnd", "bool", ",", "aStr", ",", "bStr", "string", ")", "string", "{", "if", "cnd", "{", "return", "aStr", "\n", "}", "\n", "return", "bStr", "\n", "}" ]
// strIf returns aStr if cnd is true, otherwise bStr
[ "strIf", "returns", "aStr", "if", "cnd", "is", "true", "otherwise", "bStr" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L149-L154
21,840
jung-kurt/gofpdf
util.go
UnicodeTranslator
func UnicodeTranslator(r io.Reader) (f func(string) string, err error) { m := make(map[rune]byte) var uPos, cPos uint32 var lineStr, nameStr string sc := bufio.NewScanner(r) for sc.Scan() { lineStr = sc.Text() lineStr = strings.TrimSpace(lineStr) if len(lineStr) > 0 { _, err = fmt.Sscanf(lineStr, "!%2X U+...
go
func UnicodeTranslator(r io.Reader) (f func(string) string, err error) { m := make(map[rune]byte) var uPos, cPos uint32 var lineStr, nameStr string sc := bufio.NewScanner(r) for sc.Scan() { lineStr = sc.Text() lineStr = strings.TrimSpace(lineStr) if len(lineStr) > 0 { _, err = fmt.Sscanf(lineStr, "!%2X U+...
[ "func", "UnicodeTranslator", "(", "r", "io", ".", "Reader", ")", "(", "f", "func", "(", "string", ")", "string", ",", "err", "error", ")", "{", "m", ":=", "make", "(", "map", "[", "rune", "]", "byte", ")", "\n", "var", "uPos", ",", "cPos", "uint3...
// UnicodeTranslator returns a function that can be used to translate, where // possible, utf-8 strings to a form that is compatible with the specified code // page. The returned function accepts a string and returns a string. // // r is a reader that should read a buffer made up of content lines that // pertain to the...
[ "UnicodeTranslator", "returns", "a", "function", "that", "can", "be", "used", "to", "translate", "where", "possible", "utf", "-", "8", "strings", "to", "a", "form", "that", "is", "compatible", "with", "the", "specified", "code", "page", ".", "The", "returned...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L207-L230
21,841
jung-kurt/gofpdf
util.go
UnicodeTranslatorFromFile
func UnicodeTranslatorFromFile(fileStr string) (f func(string) string, err error) { var fl *os.File fl, err = os.Open(fileStr) if err == nil { f, err = UnicodeTranslator(fl) fl.Close() } else { f = doNothing } return }
go
func UnicodeTranslatorFromFile(fileStr string) (f func(string) string, err error) { var fl *os.File fl, err = os.Open(fileStr) if err == nil { f, err = UnicodeTranslator(fl) fl.Close() } else { f = doNothing } return }
[ "func", "UnicodeTranslatorFromFile", "(", "fileStr", "string", ")", "(", "f", "func", "(", "string", ")", "string", ",", "err", "error", ")", "{", "var", "fl", "*", "os", ".", "File", "\n", "fl", ",", "err", "=", "os", ".", "Open", "(", "fileStr", ...
// UnicodeTranslatorFromFile returns a function that can be used to translate, // where possible, utf-8 strings to a form that is compatible with the // specified code page. See UnicodeTranslator for more details. // // fileStr identifies a font descriptor file that maps glyph positions to names. // // If an error occu...
[ "UnicodeTranslatorFromFile", "returns", "a", "function", "that", "can", "be", "used", "to", "translate", "where", "possible", "utf", "-", "8", "strings", "to", "a", "form", "that", "is", "compatible", "with", "the", "specified", "code", "page", ".", "See", "...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L240-L250
21,842
jung-kurt/gofpdf
util.go
Transform
func (p *PointType) Transform(x, y float64) PointType { return PointType{p.X + x, p.Y + y} }
go
func (p *PointType) Transform(x, y float64) PointType { return PointType{p.X + x, p.Y + y} }
[ "func", "(", "p", "*", "PointType", ")", "Transform", "(", "x", ",", "y", "float64", ")", "PointType", "{", "return", "PointType", "{", "p", ".", "X", "+", "x", ",", "p", ".", "Y", "+", "y", "}", "\n", "}" ]
// Transform moves a point by given X, Y offset
[ "Transform", "moves", "a", "point", "by", "given", "X", "Y", "offset" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L285-L287
21,843
jung-kurt/gofpdf
util.go
ScaleBy
func (s *SizeType) ScaleBy(factor float64) SizeType { return SizeType{s.Wd * factor, s.Ht * factor} }
go
func (s *SizeType) ScaleBy(factor float64) SizeType { return SizeType{s.Wd * factor, s.Ht * factor} }
[ "func", "(", "s", "*", "SizeType", ")", "ScaleBy", "(", "factor", "float64", ")", "SizeType", "{", "return", "SizeType", "{", "s", ".", "Wd", "*", "factor", ",", "s", ".", "Ht", "*", "factor", "}", "\n", "}" ]
// ScaleBy expands a size by a certain factor
[ "ScaleBy", "expands", "a", "size", "by", "a", "certain", "factor" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L302-L304
21,844
jung-kurt/gofpdf
util.go
ScaleToWidth
func (s *SizeType) ScaleToWidth(width float64) SizeType { height := s.Ht * width / s.Wd return SizeType{width, height} }
go
func (s *SizeType) ScaleToWidth(width float64) SizeType { height := s.Ht * width / s.Wd return SizeType{width, height} }
[ "func", "(", "s", "*", "SizeType", ")", "ScaleToWidth", "(", "width", "float64", ")", "SizeType", "{", "height", ":=", "s", ".", "Ht", "*", "width", "/", "s", ".", "Wd", "\n", "return", "SizeType", "{", "width", ",", "height", "}", "\n", "}" ]
// ScaleToWidth adjusts the height of a size to match the given width
[ "ScaleToWidth", "adjusts", "the", "height", "of", "a", "size", "to", "match", "the", "given", "width" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L307-L310
21,845
jung-kurt/gofpdf
util.go
ScaleToHeight
func (s *SizeType) ScaleToHeight(height float64) SizeType { width := s.Wd * height / s.Ht return SizeType{width, height} }
go
func (s *SizeType) ScaleToHeight(height float64) SizeType { width := s.Wd * height / s.Ht return SizeType{width, height} }
[ "func", "(", "s", "*", "SizeType", ")", "ScaleToHeight", "(", "height", "float64", ")", "SizeType", "{", "width", ":=", "s", ".", "Wd", "*", "height", "/", "s", ".", "Ht", "\n", "return", "SizeType", "{", "width", ",", "height", "}", "\n", "}" ]
// ScaleToHeight adjusts the width of a size to match the given height
[ "ScaleToHeight", "adjusts", "the", "width", "of", "a", "size", "to", "match", "the", "given", "height" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/util.go#L313-L316
21,846
jung-kurt/gofpdf
template.go
CreateTemplate
func (f *Fpdf) CreateTemplate(fn func(*Tpl)) Template { return newTpl(PointType{0, 0}, f.curPageSize, f.defOrientation, f.unitStr, f.fontDirStr, fn, f) }
go
func (f *Fpdf) CreateTemplate(fn func(*Tpl)) Template { return newTpl(PointType{0, 0}, f.curPageSize, f.defOrientation, f.unitStr, f.fontDirStr, fn, f) }
[ "func", "(", "f", "*", "Fpdf", ")", "CreateTemplate", "(", "fn", "func", "(", "*", "Tpl", ")", ")", "Template", "{", "return", "newTpl", "(", "PointType", "{", "0", ",", "0", "}", ",", "f", ".", "curPageSize", ",", "f", ".", "defOrientation", ",", ...
// CreateTemplate defines a new template using the current page size.
[ "CreateTemplate", "defines", "a", "new", "template", "using", "the", "current", "page", "size", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L26-L28
21,847
jung-kurt/gofpdf
template.go
CreateTemplateCustom
func (f *Fpdf) CreateTemplateCustom(corner PointType, size SizeType, fn func(*Tpl)) Template { return newTpl(corner, size, f.defOrientation, f.unitStr, f.fontDirStr, fn, f) }
go
func (f *Fpdf) CreateTemplateCustom(corner PointType, size SizeType, fn func(*Tpl)) Template { return newTpl(corner, size, f.defOrientation, f.unitStr, f.fontDirStr, fn, f) }
[ "func", "(", "f", "*", "Fpdf", ")", "CreateTemplateCustom", "(", "corner", "PointType", ",", "size", "SizeType", ",", "fn", "func", "(", "*", "Tpl", ")", ")", "Template", "{", "return", "newTpl", "(", "corner", ",", "size", ",", "f", ".", "defOrientati...
// CreateTemplateCustom starts a template, using the given bounds.
[ "CreateTemplateCustom", "starts", "a", "template", "using", "the", "given", "bounds", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L31-L33
21,848
jung-kurt/gofpdf
template.go
CreateTpl
func CreateTpl(corner PointType, size SizeType, orientationStr, unitStr, fontDirStr string, fn func(*Tpl)) Template { return newTpl(corner, size, orientationStr, unitStr, fontDirStr, fn, nil) }
go
func CreateTpl(corner PointType, size SizeType, orientationStr, unitStr, fontDirStr string, fn func(*Tpl)) Template { return newTpl(corner, size, orientationStr, unitStr, fontDirStr, fn, nil) }
[ "func", "CreateTpl", "(", "corner", "PointType", ",", "size", "SizeType", ",", "orientationStr", ",", "unitStr", ",", "fontDirStr", "string", ",", "fn", "func", "(", "*", "Tpl", ")", ")", "Template", "{", "return", "newTpl", "(", "corner", ",", "size", "...
// CreateTpl creates a template not attached to any document
[ "CreateTpl", "creates", "a", "template", "not", "attached", "to", "any", "document" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L52-L54
21,849
jung-kurt/gofpdf
template.go
UseTemplate
func (f *Fpdf) UseTemplate(t Template) { if t == nil { f.SetErrorf("template is nil") return } corner, size := t.Size() f.UseTemplateScaled(t, corner, size) }
go
func (f *Fpdf) UseTemplate(t Template) { if t == nil { f.SetErrorf("template is nil") return } corner, size := t.Size() f.UseTemplateScaled(t, corner, size) }
[ "func", "(", "f", "*", "Fpdf", ")", "UseTemplate", "(", "t", "Template", ")", "{", "if", "t", "==", "nil", "{", "f", ".", "SetErrorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "corner", ",", "size", ":=", "t", ".", "Size", "(", ...
// UseTemplate adds a template to the current page or another template, // using the size and position at which it was originally written.
[ "UseTemplate", "adds", "a", "template", "to", "the", "current", "page", "or", "another", "template", "using", "the", "size", "and", "position", "at", "which", "it", "was", "originally", "written", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L58-L65
21,850
jung-kurt/gofpdf
template.go
UseTemplateScaled
func (f *Fpdf) UseTemplateScaled(t Template, corner PointType, size SizeType) { if t == nil { f.SetErrorf("template is nil") return } // You have to add at least a page first if f.page <= 0 { f.SetErrorf("cannot use a template without first adding a page") return } // make a note of the fact that we act...
go
func (f *Fpdf) UseTemplateScaled(t Template, corner PointType, size SizeType) { if t == nil { f.SetErrorf("template is nil") return } // You have to add at least a page first if f.page <= 0 { f.SetErrorf("cannot use a template without first adding a page") return } // make a note of the fact that we act...
[ "func", "(", "f", "*", "Fpdf", ")", "UseTemplateScaled", "(", "t", "Template", ",", "corner", "PointType", ",", "size", "SizeType", ")", "{", "if", "t", "==", "nil", "{", "f", ".", "SetErrorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n...
// UseTemplateScaled adds a template to the current page or another template, // using the given page coordinates.
[ "UseTemplateScaled", "adds", "a", "template", "to", "the", "current", "page", "or", "another", "template", "using", "the", "given", "page", "coordinates", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L69-L101
21,851
jung-kurt/gofpdf
template.go
putTemplates
func (f *Fpdf) putTemplates() { filter := "" if f.compress { filter = "/Filter /FlateDecode " } templates := sortTemplates(f.templates, f.catalogSort) var t Template for _, t = range templates { corner, size := t.Size() f.newobj() f.templateObjects[t.ID()] = f.n f.outf("<<%s/Type /XObject", filter) ...
go
func (f *Fpdf) putTemplates() { filter := "" if f.compress { filter = "/Filter /FlateDecode " } templates := sortTemplates(f.templates, f.catalogSort) var t Template for _, t = range templates { corner, size := t.Size() f.newobj() f.templateObjects[t.ID()] = f.n f.outf("<<%s/Type /XObject", filter) ...
[ "func", "(", "f", "*", "Fpdf", ")", "putTemplates", "(", ")", "{", "filter", ":=", "\"", "\"", "\n", "if", "f", ".", "compress", "{", "filter", "=", "\"", "\"", "\n", "}", "\n\n", "templates", ":=", "sortTemplates", "(", "f", ".", "templates", ",",...
// putTemplates writes the templates to the PDF
[ "putTemplates", "writes", "the", "templates", "to", "the", "PDF" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L137-L205
21,852
jung-kurt/gofpdf
template.go
sortTemplates
func sortTemplates(templates map[string]Template, catalogSort bool) []Template { chain := make([]Template, 0, len(templates)*2) // build a full set of dependency chains var keyList []string var key string var t Template keyList = templateKeyList(templates, catalogSort) for _, key = range keyList { t = templat...
go
func sortTemplates(templates map[string]Template, catalogSort bool) []Template { chain := make([]Template, 0, len(templates)*2) // build a full set of dependency chains var keyList []string var key string var t Template keyList = templateKeyList(templates, catalogSort) for _, key = range keyList { t = templat...
[ "func", "sortTemplates", "(", "templates", "map", "[", "string", "]", "Template", ",", "catalogSort", "bool", ")", "[", "]", "Template", "{", "chain", ":=", "make", "(", "[", "]", "Template", ",", "0", ",", "len", "(", "templates", ")", "*", "2", ")"...
// sortTemplates puts templates in a suitable order based on dependices
[ "sortTemplates", "puts", "templates", "in", "a", "suitable", "order", "based", "on", "dependices" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L225-L256
21,853
jung-kurt/gofpdf
template.go
templateChainDependencies
func templateChainDependencies(template Template) []Template { requires := template.Templates() chain := make([]Template, len(requires)*2) for _, req := range requires { chain = append(chain, templateChainDependencies(req)...) } chain = append(chain, template) return chain }
go
func templateChainDependencies(template Template) []Template { requires := template.Templates() chain := make([]Template, len(requires)*2) for _, req := range requires { chain = append(chain, templateChainDependencies(req)...) } chain = append(chain, template) return chain }
[ "func", "templateChainDependencies", "(", "template", "Template", ")", "[", "]", "Template", "{", "requires", ":=", "template", ".", "Templates", "(", ")", "\n", "chain", ":=", "make", "(", "[", "]", "Template", ",", "len", "(", "requires", ")", "*", "2"...
// templateChainDependencies is a recursive function for determining the full chain of template dependencies
[ "templateChainDependencies", "is", "a", "recursive", "function", "for", "determining", "the", "full", "chain", "of", "template", "dependencies" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template.go#L259-L267
21,854
jung-kurt/gofpdf
spotcolor.go
AddSpotColor
func (f *Fpdf) AddSpotColor(nameStr string, c, m, y, k byte) { if f.err == nil { _, ok := f.spotColorMap[nameStr] if !ok { id := len(f.spotColorMap) + 1 f.spotColorMap[nameStr] = spotColorType{ id: id, val: cmykColorType{ c: byteBound(c), m: byteBound(m), y: byteBound(y), k: byteB...
go
func (f *Fpdf) AddSpotColor(nameStr string, c, m, y, k byte) { if f.err == nil { _, ok := f.spotColorMap[nameStr] if !ok { id := len(f.spotColorMap) + 1 f.spotColorMap[nameStr] = spotColorType{ id: id, val: cmykColorType{ c: byteBound(c), m: byteBound(m), y: byteBound(y), k: byteB...
[ "func", "(", "f", "*", "Fpdf", ")", "AddSpotColor", "(", "nameStr", "string", ",", "c", ",", "m", ",", "y", ",", "k", "byte", ")", "{", "if", "f", ".", "err", "==", "nil", "{", "_", ",", "ok", ":=", "f", ".", "spotColorMap", "[", "nameStr", "...
// AddSpotColor adds an ink-based CMYK color to the gofpdf instance and // associates it with the specified name. The individual components specify // percentages ranging from 0 to 100. Values above this are quietly capped to // 100. An error occurs if the specified name is already associated with a // color.
[ "AddSpotColor", "adds", "an", "ink", "-", "based", "CMYK", "color", "to", "the", "gofpdf", "instance", "and", "associates", "it", "with", "the", "specified", "name", ".", "The", "individual", "components", "specify", "percentages", "ranging", "from", "0", "to"...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/spotcolor.go#L36-L54
21,855
jung-kurt/gofpdf
spotcolor.go
GetDrawSpotColor
func (f *Fpdf) GetDrawSpotColor() (name string, c, m, y, k byte) { return f.returnSpotColor(f.color.draw) }
go
func (f *Fpdf) GetDrawSpotColor() (name string, c, m, y, k byte) { return f.returnSpotColor(f.color.draw) }
[ "func", "(", "f", "*", "Fpdf", ")", "GetDrawSpotColor", "(", ")", "(", "name", "string", ",", "c", ",", "m", ",", "y", ",", "k", "byte", ")", "{", "return", "f", ".", "returnSpotColor", "(", "f", ".", "color", ".", "draw", ")", "\n", "}" ]
// GetDrawSpotColor returns the most recently used spot color information for // drawing. This will not be the current drawing color if some other color type // such as RGB is active. If no spot color has been set for drawing, zero // values are returned.
[ "GetDrawSpotColor", "returns", "the", "most", "recently", "used", "spot", "color", "information", "for", "drawing", ".", "This", "will", "not", "be", "the", "current", "drawing", "color", "if", "some", "other", "color", "type", "such", "as", "RGB", "is", "ac...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/spotcolor.go#L143-L145
21,856
jung-kurt/gofpdf
spotcolor.go
GetTextSpotColor
func (f *Fpdf) GetTextSpotColor() (name string, c, m, y, k byte) { return f.returnSpotColor(f.color.text) }
go
func (f *Fpdf) GetTextSpotColor() (name string, c, m, y, k byte) { return f.returnSpotColor(f.color.text) }
[ "func", "(", "f", "*", "Fpdf", ")", "GetTextSpotColor", "(", ")", "(", "name", "string", ",", "c", ",", "m", ",", "y", ",", "k", "byte", ")", "{", "return", "f", ".", "returnSpotColor", "(", "f", ".", "color", ".", "text", ")", "\n", "}" ]
// GetTextSpotColor returns the most recently used spot color information for // text output. This will not be the current text color if some other color // type such as RGB is active. If no spot color has been set for text, zero // values are returned.
[ "GetTextSpotColor", "returns", "the", "most", "recently", "used", "spot", "color", "information", "for", "text", "output", ".", "This", "will", "not", "be", "the", "current", "text", "color", "if", "some", "other", "color", "type", "such", "as", "RGB", "is",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/spotcolor.go#L151-L153
21,857
jung-kurt/gofpdf
spotcolor.go
GetFillSpotColor
func (f *Fpdf) GetFillSpotColor() (name string, c, m, y, k byte) { return f.returnSpotColor(f.color.fill) }
go
func (f *Fpdf) GetFillSpotColor() (name string, c, m, y, k byte) { return f.returnSpotColor(f.color.fill) }
[ "func", "(", "f", "*", "Fpdf", ")", "GetFillSpotColor", "(", ")", "(", "name", "string", ",", "c", ",", "m", ",", "y", ",", "k", "byte", ")", "{", "return", "f", ".", "returnSpotColor", "(", "f", ".", "color", ".", "fill", ")", "\n", "}" ]
// GetFillSpotColor returns the most recently used spot color information for // fill output. This will not be the current fill color if some other color // type such as RGB is active. If no fill spot color has been set, zero values // are returned.
[ "GetFillSpotColor", "returns", "the", "most", "recently", "used", "spot", "color", "information", "for", "fill", "output", ".", "This", "will", "not", "be", "the", "current", "fill", "color", "if", "some", "other", "color", "type", "such", "as", "RGB", "is",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/spotcolor.go#L159-L161
21,858
jung-kurt/gofpdf
layer.go
BeginLayer
func (f *Fpdf) BeginLayer(id int) { f.EndLayer() if id >= 0 && id < len(f.layer.list) { f.outf("/OC /OC%d BDC", id) f.layer.currentLayer = id } }
go
func (f *Fpdf) BeginLayer(id int) { f.EndLayer() if id >= 0 && id < len(f.layer.list) { f.outf("/OC /OC%d BDC", id) f.layer.currentLayer = id } }
[ "func", "(", "f", "*", "Fpdf", ")", "BeginLayer", "(", "id", "int", ")", "{", "f", ".", "EndLayer", "(", ")", "\n", "if", "id", ">=", "0", "&&", "id", "<", "len", "(", "f", ".", "layer", ".", "list", ")", "{", "f", ".", "outf", "(", "\"", ...
// BeginLayer is called to begin adding content to the specified layer. All // content added to the page between a call to BeginLayer and a call to // EndLayer is added to the layer specified by id. See AddLayer for more // details.
[ "BeginLayer", "is", "called", "to", "begin", "adding", "content", "to", "the", "specified", "layer", ".", "All", "content", "added", "to", "the", "page", "between", "a", "call", "to", "BeginLayer", "and", "a", "call", "to", "EndLayer", "is", "added", "to",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/layer.go#L55-L61
21,859
jung-kurt/gofpdf
layer.go
EndLayer
func (f *Fpdf) EndLayer() { if f.layer.currentLayer >= 0 { f.out("EMC") f.layer.currentLayer = -1 } }
go
func (f *Fpdf) EndLayer() { if f.layer.currentLayer >= 0 { f.out("EMC") f.layer.currentLayer = -1 } }
[ "func", "(", "f", "*", "Fpdf", ")", "EndLayer", "(", ")", "{", "if", "f", ".", "layer", ".", "currentLayer", ">=", "0", "{", "f", ".", "out", "(", "\"", "\"", ")", "\n", "f", ".", "layer", ".", "currentLayer", "=", "-", "1", "\n", "}", "\n", ...
// EndLayer is called to stop adding content to the currently active layer. See // BeginLayer for more details.
[ "EndLayer", "is", "called", "to", "stop", "adding", "content", "to", "the", "currently", "active", "layer", ".", "See", "BeginLayer", "for", "more", "details", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/layer.go#L65-L70
21,860
jung-kurt/gofpdf
contrib/barcode/barcode.go
GetUnscaledBarcodeDimensions
func GetUnscaledBarcodeDimensions(pdf barcodePdf, code string) (w, h float64) { barcodes.Lock() unscaled, ok := barcodes.cache[code] barcodes.Unlock() if !ok { err := errors.New("Barcode not found") pdf.SetError(err) return } return convertFrom96Dpi(pdf, float64(unscaled.Bounds().Dx())), convertFrom96Dp...
go
func GetUnscaledBarcodeDimensions(pdf barcodePdf, code string) (w, h float64) { barcodes.Lock() unscaled, ok := barcodes.cache[code] barcodes.Unlock() if !ok { err := errors.New("Barcode not found") pdf.SetError(err) return } return convertFrom96Dpi(pdf, float64(unscaled.Bounds().Dx())), convertFrom96Dp...
[ "func", "GetUnscaledBarcodeDimensions", "(", "pdf", "barcodePdf", ",", "code", "string", ")", "(", "w", ",", "h", "float64", ")", "{", "barcodes", ".", "Lock", "(", ")", "\n", "unscaled", ",", "ok", ":=", "barcodes", ".", "cache", "[", "code", "]", "\n...
// GetUnscaledBarcodeDimensions returns the width and height of the // unscaled barcode associated with the given code.
[ "GetUnscaledBarcodeDimensions", "returns", "the", "width", "and", "height", "of", "the", "unscaled", "barcode", "associated", "with", "the", "given", "code", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/contrib/barcode/barcode.go#L127-L140
21,861
jung-kurt/gofpdf
contrib/barcode/barcode.go
uniqueBarcodeName
func uniqueBarcodeName(code string, x, y float64) string { xStr := strconv.FormatFloat(x, 'E', -1, 64) yStr := strconv.FormatFloat(y, 'E', -1, 64) return "barcode-" + code + "-" + xStr + yStr }
go
func uniqueBarcodeName(code string, x, y float64) string { xStr := strconv.FormatFloat(x, 'E', -1, 64) yStr := strconv.FormatFloat(y, 'E', -1, 64) return "barcode-" + code + "-" + xStr + yStr }
[ "func", "uniqueBarcodeName", "(", "code", "string", ",", "x", ",", "y", "float64", ")", "string", "{", "xStr", ":=", "strconv", ".", "FormatFloat", "(", "x", ",", "'E'", ",", "-", "1", ",", "64", ")", "\n", "yStr", ":=", "strconv", ".", "FormatFloat"...
// uniqueBarcodeName makes sure every barcode has a unique name for its // dimensions. Scaling a barcode image results in quality loss, which could be // a problem for barcode readers.
[ "uniqueBarcodeName", "makes", "sure", "every", "barcode", "has", "a", "unique", "name", "for", "its", "dimensions", ".", "Scaling", "a", "barcode", "image", "results", "in", "quality", "loss", "which", "could", "be", "a", "problem", "for", "barcode", "readers"...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/contrib/barcode/barcode.go#L252-L257
21,862
jung-kurt/gofpdf
contrib/barcode/barcode.go
barcodeKey
func barcodeKey(bcode barcode.Barcode) string { return bcode.Metadata().CodeKind + bcode.Content() }
go
func barcodeKey(bcode barcode.Barcode) string { return bcode.Metadata().CodeKind + bcode.Content() }
[ "func", "barcodeKey", "(", "bcode", "barcode", ".", "Barcode", ")", "string", "{", "return", "bcode", ".", "Metadata", "(", ")", ".", "CodeKind", "+", "bcode", ".", "Content", "(", ")", "\n", "}" ]
// barcodeKey combines the code type and code value into a unique identifier for // a barcode type. This is so that we can store several barcodes with the same // code but different type in the barcodes map.
[ "barcodeKey", "combines", "the", "code", "type", "and", "code", "value", "into", "a", "unique", "identifier", "for", "a", "barcode", "type", ".", "This", "is", "so", "that", "we", "can", "store", "several", "barcodes", "with", "the", "same", "code", "but",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/contrib/barcode/barcode.go#L262-L264
21,863
jung-kurt/gofpdf
grid.go
StateGet
func StateGet(pdf *Fpdf) (st StateType) { st.clrDraw.R, st.clrDraw.G, st.clrDraw.B = pdf.GetDrawColor() st.clrFill.R, st.clrFill.G, st.clrFill.B = pdf.GetFillColor() st.clrText.R, st.clrText.G, st.clrText.B = pdf.GetTextColor() st.lineWd = pdf.GetLineWidth() _, st.fontSize = pdf.GetFontSize() st.alpha, st.blendSt...
go
func StateGet(pdf *Fpdf) (st StateType) { st.clrDraw.R, st.clrDraw.G, st.clrDraw.B = pdf.GetDrawColor() st.clrFill.R, st.clrFill.G, st.clrFill.B = pdf.GetFillColor() st.clrText.R, st.clrText.G, st.clrText.B = pdf.GetTextColor() st.lineWd = pdf.GetLineWidth() _, st.fontSize = pdf.GetFontSize() st.alpha, st.blendSt...
[ "func", "StateGet", "(", "pdf", "*", "Fpdf", ")", "(", "st", "StateType", ")", "{", "st", ".", "clrDraw", ".", "R", ",", "st", ".", "clrDraw", ".", "G", ",", "st", ".", "clrDraw", ".", "B", "=", "pdf", ".", "GetDrawColor", "(", ")", "\n", "st",...
// StateGet returns a variable that contains common state values.
[ "StateGet", "returns", "a", "variable", "that", "contains", "common", "state", "values", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L35-L44
21,864
jung-kurt/gofpdf
grid.go
Put
func (st StateType) Put(pdf *Fpdf) { pdf.SetDrawColor(st.clrDraw.R, st.clrDraw.G, st.clrDraw.B) pdf.SetFillColor(st.clrFill.R, st.clrFill.G, st.clrFill.B) pdf.SetTextColor(st.clrText.R, st.clrText.G, st.clrText.B) pdf.SetLineWidth(st.lineWd) pdf.SetFontUnitSize(st.fontSize) pdf.SetAlpha(st.alpha, st.blendStr) pd...
go
func (st StateType) Put(pdf *Fpdf) { pdf.SetDrawColor(st.clrDraw.R, st.clrDraw.G, st.clrDraw.B) pdf.SetFillColor(st.clrFill.R, st.clrFill.G, st.clrFill.B) pdf.SetTextColor(st.clrText.R, st.clrText.G, st.clrText.B) pdf.SetLineWidth(st.lineWd) pdf.SetFontUnitSize(st.fontSize) pdf.SetAlpha(st.alpha, st.blendStr) pd...
[ "func", "(", "st", "StateType", ")", "Put", "(", "pdf", "*", "Fpdf", ")", "{", "pdf", ".", "SetDrawColor", "(", "st", ".", "clrDraw", ".", "R", ",", "st", ".", "clrDraw", ".", "G", ",", "st", ".", "clrDraw", ".", "B", ")", "\n", "pdf", ".", "...
// Put sets the common state values contained in the state structure // specified by st.
[ "Put", "sets", "the", "common", "state", "values", "contained", "in", "the", "state", "structure", "specified", "by", "st", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L48-L56
21,865
jung-kurt/gofpdf
grid.go
defaultFormatter
func defaultFormatter(val float64, precision int) string { return strconv.FormatFloat(val, 'f', precision, 64) }
go
func defaultFormatter(val float64, precision int) string { return strconv.FormatFloat(val, 'f', precision, 64) }
[ "func", "defaultFormatter", "(", "val", "float64", ",", "precision", "int", ")", "string", "{", "return", "strconv", ".", "FormatFloat", "(", "val", ",", "'f'", ",", "precision", ",", "64", ")", "\n", "}" ]
// defaultFormatter returns the string form of val with precision decimal places.
[ "defaultFormatter", "returns", "the", "string", "form", "of", "val", "with", "precision", "decimal", "places", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L62-L64
21,866
jung-kurt/gofpdf
grid.go
XY
func (g GridType) XY(dataX, dataY float64) (x, y float64) { return g.xm*dataX + g.xb, g.ym*dataY + g.yb }
go
func (g GridType) XY(dataX, dataY float64) (x, y float64) { return g.xm*dataX + g.xb, g.ym*dataY + g.yb }
[ "func", "(", "g", "GridType", ")", "XY", "(", "dataX", ",", "dataY", "float64", ")", "(", "x", ",", "y", "float64", ")", "{", "return", "g", ".", "xm", "*", "dataX", "+", "g", ".", "xb", ",", "g", ".", "ym", "*", "dataY", "+", "g", ".", "yb...
// XY converts dataX and dataY, specified in logical data units, to the X and Y // position on the current page.
[ "XY", "converts", "dataX", "and", "dataY", "specified", "in", "logical", "data", "units", "to", "the", "X", "and", "Y", "position", "on", "the", "current", "page", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L167-L169
21,867
jung-kurt/gofpdf
grid.go
Pos
func (g GridType) Pos(xRel, yRel float64) (x, y float64) { x = g.w*xRel + g.x y = g.h*(1-yRel) + g.y return }
go
func (g GridType) Pos(xRel, yRel float64) (x, y float64) { x = g.w*xRel + g.x y = g.h*(1-yRel) + g.y return }
[ "func", "(", "g", "GridType", ")", "Pos", "(", "xRel", ",", "yRel", "float64", ")", "(", "x", ",", "y", "float64", ")", "{", "x", "=", "g", ".", "w", "*", "xRel", "+", "g", ".", "x", "\n", "y", "=", "g", ".", "h", "*", "(", "1", "-", "y...
// Pos returns the point, in page units, indicated by the relative positions // xRel and yRel. These are values between 0 and 1. xRel specifies the relative // position between the grid's left and right edges. yRel specifies the // relative position between the grid's bottom and top edges.
[ "Pos", "returns", "the", "point", "in", "page", "units", "indicated", "by", "the", "relative", "positions", "xRel", "and", "yRel", ".", "These", "are", "values", "between", "0", "and", "1", ".", "xRel", "specifies", "the", "relative", "position", "between", ...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L175-L179
21,868
jung-kurt/gofpdf
grid.go
X
func (g GridType) X(dataX float64) float64 { return g.xm*dataX + g.xb }
go
func (g GridType) X(dataX float64) float64 { return g.xm*dataX + g.xb }
[ "func", "(", "g", "GridType", ")", "X", "(", "dataX", "float64", ")", "float64", "{", "return", "g", ".", "xm", "*", "dataX", "+", "g", ".", "xb", "\n", "}" ]
// X converts dataX, specified in logical data units, to the X position on the // current page.
[ "X", "converts", "dataX", "specified", "in", "logical", "data", "units", "to", "the", "X", "position", "on", "the", "current", "page", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L183-L185
21,869
jung-kurt/gofpdf
grid.go
Y
func (g GridType) Y(dataY float64) float64 { return g.ym*dataY + g.yb }
go
func (g GridType) Y(dataY float64) float64 { return g.ym*dataY + g.yb }
[ "func", "(", "g", "GridType", ")", "Y", "(", "dataY", "float64", ")", "float64", "{", "return", "g", ".", "ym", "*", "dataY", "+", "g", ".", "yb", "\n", "}" ]
// Y converts dataY, specified in logical data units, to the Y position on the // current page.
[ "Y", "converts", "dataY", "specified", "in", "logical", "data", "units", "to", "the", "Y", "position", "on", "the", "current", "page", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L201-L203
21,870
jung-kurt/gofpdf
grid.go
XRange
func (g GridType) XRange() (min, max float64) { min = g.xTicks[0] max = g.xTicks[len(g.xTicks)-1] return }
go
func (g GridType) XRange() (min, max float64) { min = g.xTicks[0] max = g.xTicks[len(g.xTicks)-1] return }
[ "func", "(", "g", "GridType", ")", "XRange", "(", ")", "(", "min", ",", "max", "float64", ")", "{", "min", "=", "g", ".", "xTicks", "[", "0", "]", "\n", "max", "=", "g", ".", "xTicks", "[", "len", "(", "g", ".", "xTicks", ")", "-", "1", "]"...
// XRange returns the minimum and maximum values for the current tickmark // sequence. These correspond to the data values of the graph's left and right // edges.
[ "XRange", "returns", "the", "minimum", "and", "maximum", "values", "for", "the", "current", "tickmark", "sequence", ".", "These", "correspond", "to", "the", "data", "values", "of", "the", "graph", "s", "left", "and", "right", "edges", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L208-L212
21,871
jung-kurt/gofpdf
grid.go
YRange
func (g GridType) YRange() (min, max float64) { min = g.yTicks[0] max = g.yTicks[len(g.yTicks)-1] return }
go
func (g GridType) YRange() (min, max float64) { min = g.yTicks[0] max = g.yTicks[len(g.yTicks)-1] return }
[ "func", "(", "g", "GridType", ")", "YRange", "(", ")", "(", "min", ",", "max", "float64", ")", "{", "min", "=", "g", ".", "yTicks", "[", "0", "]", "\n", "max", "=", "g", ".", "yTicks", "[", "len", "(", "g", ".", "yTicks", ")", "-", "1", "]"...
// YRange returns the minimum and maximum values for the current tickmark // sequence. These correspond to the data values of the graph's bottom and top // edges.
[ "YRange", "returns", "the", "minimum", "and", "maximum", "values", "for", "the", "current", "tickmark", "sequence", ".", "These", "correspond", "to", "the", "data", "values", "of", "the", "graph", "s", "bottom", "and", "top", "edges", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/grid.go#L217-L221
21,872
jung-kurt/gofpdf
htmlbasic.go
HTMLBasicTokenize
func HTMLBasicTokenize(htmlStr string) (list []HTMLBasicSegmentType) { // This routine is adapted from http://www.fpdf.org/ list = make([]HTMLBasicSegmentType, 0, 16) htmlStr = strings.Replace(htmlStr, "\n", " ", -1) htmlStr = strings.Replace(htmlStr, "\r", "", -1) tagRe, _ := regexp.Compile(`(?U)<.*>`) attrRe, _...
go
func HTMLBasicTokenize(htmlStr string) (list []HTMLBasicSegmentType) { // This routine is adapted from http://www.fpdf.org/ list = make([]HTMLBasicSegmentType, 0, 16) htmlStr = strings.Replace(htmlStr, "\n", " ", -1) htmlStr = strings.Replace(htmlStr, "\r", "", -1) tagRe, _ := regexp.Compile(`(?U)<.*>`) attrRe, _...
[ "func", "HTMLBasicTokenize", "(", "htmlStr", "string", ")", "(", "list", "[", "]", "HTMLBasicSegmentType", ")", "{", "// This routine is adapted from http://www.fpdf.org/", "list", "=", "make", "(", "[", "]", "HTMLBasicSegmentType", ",", "0", ",", "16", ")", "\n",...
// HTMLBasicTokenize returns a list of HTML tags and literal elements. This is // done with regular expressions, so the result is only marginally better than // useless.
[ "HTMLBasicTokenize", "returns", "a", "list", "of", "HTML", "tags", "and", "literal", "elements", ".", "This", "is", "done", "with", "regular", "expressions", "so", "the", "result", "is", "only", "marginally", "better", "than", "useless", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/htmlbasic.go#L35-L92
21,873
jung-kurt/gofpdf
htmlbasic.go
HTMLBasicNew
func (f *Fpdf) HTMLBasicNew() (html HTMLBasicType) { html.pdf = f html.Link.ClrR, html.Link.ClrG, html.Link.ClrB = 0, 0, 128 html.Link.Bold, html.Link.Italic, html.Link.Underscore = false, false, true return }
go
func (f *Fpdf) HTMLBasicNew() (html HTMLBasicType) { html.pdf = f html.Link.ClrR, html.Link.ClrG, html.Link.ClrB = 0, 0, 128 html.Link.Bold, html.Link.Italic, html.Link.Underscore = false, false, true return }
[ "func", "(", "f", "*", "Fpdf", ")", "HTMLBasicNew", "(", ")", "(", "html", "HTMLBasicType", ")", "{", "html", ".", "pdf", "=", "f", "\n", "html", ".", "Link", ".", "ClrR", ",", "html", ".", "Link", ".", "ClrG", ",", "html", ".", "Link", ".", "C...
// HTMLBasicNew returns an instance that facilitates writing basic HTML in the // specified PDF file.
[ "HTMLBasicNew", "returns", "an", "instance", "that", "facilitates", "writing", "basic", "HTML", "in", "the", "specified", "PDF", "file", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/htmlbasic.go#L109-L114
21,874
jung-kurt/gofpdf
font.go
getInfoFromTrueType
func getInfoFromTrueType(fileStr string, msgWriter io.Writer, embed bool, encList encListType) (info fontInfoType, err error) { var ttf TtfType ttf, err = TtfParse(fileStr) if err != nil { return } if embed { if !ttf.Embeddable { err = fmt.Errorf("font license does not allow embedding") return } info...
go
func getInfoFromTrueType(fileStr string, msgWriter io.Writer, embed bool, encList encListType) (info fontInfoType, err error) { var ttf TtfType ttf, err = TtfParse(fileStr) if err != nil { return } if embed { if !ttf.Embeddable { err = fmt.Errorf("font license does not allow embedding") return } info...
[ "func", "getInfoFromTrueType", "(", "fileStr", "string", ",", "msgWriter", "io", ".", "Writer", ",", "embed", "bool", ",", "encList", "encListType", ")", "(", "info", "fontInfoType", ",", "err", "error", ")", "{", "var", "ttf", "TtfType", "\n", "ttf", ",",...
// getInfoFromTrueType returns information from a TrueType font
[ "getInfoFromTrueType", "returns", "information", "from", "a", "TrueType", "font" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/font.go#L85-L138
21,875
jung-kurt/gofpdf
font.go
makeFontEncoding
func makeFontEncoding(encList encListType, refEncFileStr string) (diffStr string, err error) { var refList encListType if refList, err = loadMap(refEncFileStr); err != nil { return } var buf fmtBuffer last := 0 for j := 32; j < 256; j++ { if encList[j].name != refList[j].name { if j != last+1 { buf.pri...
go
func makeFontEncoding(encList encListType, refEncFileStr string) (diffStr string, err error) { var refList encListType if refList, err = loadMap(refEncFileStr); err != nil { return } var buf fmtBuffer last := 0 for j := 32; j < 256; j++ { if encList[j].name != refList[j].name { if j != last+1 { buf.pri...
[ "func", "makeFontEncoding", "(", "encList", "encListType", ",", "refEncFileStr", "string", ")", "(", "diffStr", "string", ",", "err", "error", ")", "{", "var", "refList", "encListType", "\n", "if", "refList", ",", "err", "=", "loadMap", "(", "refEncFileStr", ...
// makeFontEncoding builds differences from reference encoding
[ "makeFontEncoding", "builds", "differences", "from", "reference", "encoding" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/font.go#L314-L332
21,876
jung-kurt/gofpdf
template_impl.go
ID
func (t *FpdfTpl) ID() string { return fmt.Sprintf("%x", sha1.Sum(t.Bytes())) }
go
func (t *FpdfTpl) ID() string { return fmt.Sprintf("%x", sha1.Sum(t.Bytes())) }
[ "func", "(", "t", "*", "FpdfTpl", ")", "ID", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sha1", ".", "Sum", "(", "t", ".", "Bytes", "(", ")", ")", ")", "\n", "}" ]
// ID returns the global template identifier
[ "ID", "returns", "the", "global", "template", "identifier" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L67-L69
21,877
jung-kurt/gofpdf
template_impl.go
Size
func (t *FpdfTpl) Size() (corner PointType, size SizeType) { return t.corner, t.size }
go
func (t *FpdfTpl) Size() (corner PointType, size SizeType) { return t.corner, t.size }
[ "func", "(", "t", "*", "FpdfTpl", ")", "Size", "(", ")", "(", "corner", "PointType", ",", "size", "SizeType", ")", "{", "return", "t", ".", "corner", ",", "t", ".", "size", "\n", "}" ]
// Size gives the bounding dimensions of this template
[ "Size", "gives", "the", "bounding", "dimensions", "of", "this", "template" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L72-L74
21,878
jung-kurt/gofpdf
template_impl.go
FromPage
func (t *FpdfTpl) FromPage(page int) (Template, error) { // pages start at 1 if page == 0 { return nil, errors.New("Pages start at 1 No template will have a page 0") } if page > t.NumPages() { return nil, fmt.Errorf("The template does not have a page %d", page) } // if it is already pointing to the correct p...
go
func (t *FpdfTpl) FromPage(page int) (Template, error) { // pages start at 1 if page == 0 { return nil, errors.New("Pages start at 1 No template will have a page 0") } if page > t.NumPages() { return nil, fmt.Errorf("The template does not have a page %d", page) } // if it is already pointing to the correct p...
[ "func", "(", "t", "*", "FpdfTpl", ")", "FromPage", "(", "page", "int", ")", "(", "Template", ",", "error", ")", "{", "// pages start at 1", "if", "page", "==", "0", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", ...
// FromPage creates a new template from a specific Page
[ "FromPage", "creates", "a", "new", "template", "from", "a", "specific", "Page" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L82-L100
21,879
jung-kurt/gofpdf
template_impl.go
FromPages
func (t *FpdfTpl) FromPages() []Template { p := make([]Template, t.NumPages()) for x := 1; x <= t.NumPages(); x++ { // the only error is when accessing a // non existing template... that can't happen // here p[x-1], _ = t.FromPage(x) } return p }
go
func (t *FpdfTpl) FromPages() []Template { p := make([]Template, t.NumPages()) for x := 1; x <= t.NumPages(); x++ { // the only error is when accessing a // non existing template... that can't happen // here p[x-1], _ = t.FromPage(x) } return p }
[ "func", "(", "t", "*", "FpdfTpl", ")", "FromPages", "(", ")", "[", "]", "Template", "{", "p", ":=", "make", "(", "[", "]", "Template", ",", "t", ".", "NumPages", "(", ")", ")", "\n", "for", "x", ":=", "1", ";", "x", "<=", "t", ".", "NumPages"...
// FromPages creates a template slice with all the pages within a template.
[ "FromPages", "creates", "a", "template", "slice", "with", "all", "the", "pages", "within", "a", "template", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L103-L113
21,880
jung-kurt/gofpdf
template_impl.go
Serialize
func (t *FpdfTpl) Serialize() ([]byte, error) { b := new(bytes.Buffer) enc := gob.NewEncoder(b) err := enc.Encode(t) return b.Bytes(), err }
go
func (t *FpdfTpl) Serialize() ([]byte, error) { b := new(bytes.Buffer) enc := gob.NewEncoder(b) err := enc.Encode(t) return b.Bytes(), err }
[ "func", "(", "t", "*", "FpdfTpl", ")", "Serialize", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "b", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "enc", ":=", "gob", ".", "NewEncoder", "(", "b", ")", "\n", "err", ":=", "e...
// Serialize turns a template into a byte string for later deserialization
[ "Serialize", "turns", "a", "template", "into", "a", "byte", "string", "for", "later", "deserialization" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L133-L139
21,881
jung-kurt/gofpdf
template_impl.go
DeserializeTemplate
func DeserializeTemplate(b []byte) (Template, error) { tpl := new(FpdfTpl) dec := gob.NewDecoder(bytes.NewBuffer(b)) err := dec.Decode(tpl) return tpl, err }
go
func DeserializeTemplate(b []byte) (Template, error) { tpl := new(FpdfTpl) dec := gob.NewDecoder(bytes.NewBuffer(b)) err := dec.Decode(tpl) return tpl, err }
[ "func", "DeserializeTemplate", "(", "b", "[", "]", "byte", ")", "(", "Template", ",", "error", ")", "{", "tpl", ":=", "new", "(", "FpdfTpl", ")", "\n", "dec", ":=", "gob", ".", "NewDecoder", "(", "bytes", ".", "NewBuffer", "(", "b", ")", ")", "\n",...
// DeserializeTemplate creaties a template from a previously serialized // template
[ "DeserializeTemplate", "creaties", "a", "template", "from", "a", "previously", "serialized", "template" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L143-L148
21,882
jung-kurt/gofpdf
template_impl.go
childrenImages
func (t *FpdfTpl) childrenImages() map[string]*ImageInfoType { childrenImgs := make(map[string]*ImageInfoType) for x := 0; x < len(t.templates); x++ { imgs := t.templates[x].Images() for key, val := range imgs { name := sprintf("t%s-%s", t.templates[x].ID(), key) childrenImgs[name] = val } } return ch...
go
func (t *FpdfTpl) childrenImages() map[string]*ImageInfoType { childrenImgs := make(map[string]*ImageInfoType) for x := 0; x < len(t.templates); x++ { imgs := t.templates[x].Images() for key, val := range imgs { name := sprintf("t%s-%s", t.templates[x].ID(), key) childrenImgs[name] = val } } return ch...
[ "func", "(", "t", "*", "FpdfTpl", ")", "childrenImages", "(", ")", "map", "[", "string", "]", "*", "ImageInfoType", "{", "childrenImgs", ":=", "make", "(", "map", "[", "string", "]", "*", "ImageInfoType", ")", "\n\n", "for", "x", ":=", "0", ";", "x",...
// childrenImages returns the next layer of children images, it doesn't dig into // children of children. Applies template namespace to keys to ensure // no collisions. See UseTemplateScaled
[ "childrenImages", "returns", "the", "next", "layer", "of", "children", "images", "it", "doesn", "t", "dig", "into", "children", "of", "children", ".", "Applies", "template", "namespace", "to", "keys", "to", "ensure", "no", "collisions", ".", "See", "UseTemplat...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L153-L165
21,883
jung-kurt/gofpdf
template_impl.go
childrensTemplates
func (t *FpdfTpl) childrensTemplates() []Template { childrenTmpls := make([]Template, 0) for x := 0; x < len(t.templates); x++ { tmpls := t.templates[x].Templates() childrenTmpls = append(childrenTmpls, tmpls...) } return childrenTmpls }
go
func (t *FpdfTpl) childrensTemplates() []Template { childrenTmpls := make([]Template, 0) for x := 0; x < len(t.templates); x++ { tmpls := t.templates[x].Templates() childrenTmpls = append(childrenTmpls, tmpls...) } return childrenTmpls }
[ "func", "(", "t", "*", "FpdfTpl", ")", "childrensTemplates", "(", ")", "[", "]", "Template", "{", "childrenTmpls", ":=", "make", "(", "[", "]", "Template", ",", "0", ")", "\n\n", "for", "x", ":=", "0", ";", "x", "<", "len", "(", "t", ".", "templa...
// childrensTemplates returns the next layer of children templates, it doesn't dig into // children of children.
[ "childrensTemplates", "returns", "the", "next", "layer", "of", "children", "templates", "it", "doesn", "t", "dig", "into", "children", "of", "children", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L169-L178
21,884
jung-kurt/gofpdf
template_impl.go
GobEncode
func (t *FpdfTpl) GobEncode() ([]byte, error) { w := new(bytes.Buffer) encoder := gob.NewEncoder(w) childrensTemplates := t.childrensTemplates() firstClassTemplates := make([]Template, 0) found_continue: for x := 0; x < len(t.templates); x++ { for y := 0; y < len(childrensTemplates); y++ { if childrensTempl...
go
func (t *FpdfTpl) GobEncode() ([]byte, error) { w := new(bytes.Buffer) encoder := gob.NewEncoder(w) childrensTemplates := t.childrensTemplates() firstClassTemplates := make([]Template, 0) found_continue: for x := 0; x < len(t.templates); x++ { for y := 0; y < len(childrensTemplates); y++ { if childrensTempl...
[ "func", "(", "t", "*", "FpdfTpl", ")", "GobEncode", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "encoder", ":=", "gob", ".", "NewEncoder", "(", "w", ")", "\n\n", "childrensTem...
// GobEncode encodes the receiving template into a byte buffer. Use GobDecode // to decode the byte buffer back to a template.
[ "GobEncode", "encodes", "the", "receiving", "template", "into", "a", "byte", "buffer", ".", "Use", "GobDecode", "to", "decode", "the", "byte", "buffer", "back", "to", "a", "template", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L182-L227
21,885
jung-kurt/gofpdf
template_impl.go
GobDecode
func (t *FpdfTpl) GobDecode(buf []byte) error { r := bytes.NewBuffer(buf) decoder := gob.NewDecoder(r) firstClassTemplates := make([]*FpdfTpl, 0) err := decoder.Decode(&firstClassTemplates) t.templates = make([]Template, len(firstClassTemplates)) for x := 0; x < len(t.templates); x++ { t.templates[x] = Templa...
go
func (t *FpdfTpl) GobDecode(buf []byte) error { r := bytes.NewBuffer(buf) decoder := gob.NewDecoder(r) firstClassTemplates := make([]*FpdfTpl, 0) err := decoder.Decode(&firstClassTemplates) t.templates = make([]Template, len(firstClassTemplates)) for x := 0; x < len(t.templates); x++ { t.templates[x] = Templa...
[ "func", "(", "t", "*", "FpdfTpl", ")", "GobDecode", "(", "buf", "[", "]", "byte", ")", "error", "{", "r", ":=", "bytes", ".", "NewBuffer", "(", "buf", ")", "\n", "decoder", ":=", "gob", ".", "NewDecoder", "(", "r", ")", "\n\n", "firstClassTemplates",...
// GobDecode decodes the specified byte buffer into the receiving template.
[ "GobDecode", "decodes", "the", "specified", "byte", "buffer", "into", "the", "receiving", "template", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/template_impl.go#L230-L269
21,886
jung-kurt/gofpdf
internal/example/example.go
setRoot
func setRoot() { wdStr, err := os.Getwd() if err == nil { gofpdfDir = "" list := strings.Split(filepath.ToSlash(wdStr), "/") for j := len(list) - 1; j >= 0 && list[j] != "gofpdf"; j-- { gofpdfDir = filepath.Join(gofpdfDir, "..") } } else { panic(err) } }
go
func setRoot() { wdStr, err := os.Getwd() if err == nil { gofpdfDir = "" list := strings.Split(filepath.ToSlash(wdStr), "/") for j := len(list) - 1; j >= 0 && list[j] != "gofpdf"; j-- { gofpdfDir = filepath.Join(gofpdfDir, "..") } } else { panic(err) } }
[ "func", "setRoot", "(", ")", "{", "wdStr", ",", "err", ":=", "os", ".", "Getwd", "(", ")", "\n", "if", "err", "==", "nil", "{", "gofpdfDir", "=", "\"", "\"", "\n", "list", ":=", "strings", ".", "Split", "(", "filepath", ".", "ToSlash", "(", "wdSt...
// setRoot assigns the relative path to the gofpdfDir directory based on current working // directory
[ "setRoot", "assigns", "the", "relative", "path", "to", "the", "gofpdfDir", "directory", "based", "on", "current", "working", "directory" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/internal/example/example.go#L41-L52
21,887
jung-kurt/gofpdf
compare.go
CompareBytes
func CompareBytes(sl1, sl2 []byte, printDiff bool) (err error) { var posStart, posEnd, len1, len2, length int var diffs bool len1 = len(sl1) len2 = len(sl2) length = len1 if length > len2 { length = len2 } for posStart < length-1 { posEnd = posStart + 16 if posEnd > length { posEnd = length } if !...
go
func CompareBytes(sl1, sl2 []byte, printDiff bool) (err error) { var posStart, posEnd, len1, len2, length int var diffs bool len1 = len(sl1) len2 = len(sl2) length = len1 if length > len2 { length = len2 } for posStart < length-1 { posEnd = posStart + 16 if posEnd > length { posEnd = length } if !...
[ "func", "CompareBytes", "(", "sl1", ",", "sl2", "[", "]", "byte", ",", "printDiff", "bool", ")", "(", "err", "error", ")", "{", "var", "posStart", ",", "posEnd", ",", "len1", ",", "len2", ",", "length", "int", "\n", "var", "diffs", "bool", "\n\n", ...
// CompareBytes compares the bytes referred to by sl1 with those referred to by // sl2. Nil is returned if the buffers are equal, otherwise an error.
[ "CompareBytes", "compares", "the", "bytes", "referred", "to", "by", "sl1", "with", "those", "referred", "to", "by", "sl2", ".", "Nil", "is", "returned", "if", "the", "buffers", "are", "equal", "otherwise", "an", "error", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/compare.go#L89-L113
21,888
jung-kurt/gofpdf
compare.go
ComparePDFs
func ComparePDFs(rdr1, rdr2 io.Reader, printDiff bool) (err error) { var b1, b2 *bytes.Buffer _, err = b1.ReadFrom(rdr1) if err == nil { _, err = b2.ReadFrom(rdr2) if err == nil { err = CompareBytes(b1.Bytes(), b2.Bytes(), printDiff) } } return }
go
func ComparePDFs(rdr1, rdr2 io.Reader, printDiff bool) (err error) { var b1, b2 *bytes.Buffer _, err = b1.ReadFrom(rdr1) if err == nil { _, err = b2.ReadFrom(rdr2) if err == nil { err = CompareBytes(b1.Bytes(), b2.Bytes(), printDiff) } } return }
[ "func", "ComparePDFs", "(", "rdr1", ",", "rdr2", "io", ".", "Reader", ",", "printDiff", "bool", ")", "(", "err", "error", ")", "{", "var", "b1", ",", "b2", "*", "bytes", ".", "Buffer", "\n", "_", ",", "err", "=", "b1", ".", "ReadFrom", "(", "rdr1...
// ComparePDFs reads and compares the full contents of the two specified // readers byte-for-byte. Nil is returned if the buffers are equal, otherwise // an error.
[ "ComparePDFs", "reads", "and", "compares", "the", "full", "contents", "of", "the", "two", "specified", "readers", "byte", "-", "for", "-", "byte", ".", "Nil", "is", "returned", "if", "the", "buffers", "are", "equal", "otherwise", "an", "error", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/compare.go#L118-L128
21,889
jung-kurt/gofpdf
compare.go
ComparePDFFiles
func ComparePDFFiles(file1Str, file2Str string, printDiff bool) (err error) { var sl1, sl2 []byte sl1, err = ioutil.ReadFile(file1Str) if err == nil { sl2, err = ioutil.ReadFile(file2Str) if err == nil { err = CompareBytes(sl1, sl2, printDiff) } else { // Second file is missing; treat this as success ...
go
func ComparePDFFiles(file1Str, file2Str string, printDiff bool) (err error) { var sl1, sl2 []byte sl1, err = ioutil.ReadFile(file1Str) if err == nil { sl2, err = ioutil.ReadFile(file2Str) if err == nil { err = CompareBytes(sl1, sl2, printDiff) } else { // Second file is missing; treat this as success ...
[ "func", "ComparePDFFiles", "(", "file1Str", ",", "file2Str", "string", ",", "printDiff", "bool", ")", "(", "err", "error", ")", "{", "var", "sl1", ",", "sl2", "[", "]", "byte", "\n", "sl1", ",", "err", "=", "ioutil", ".", "ReadFile", "(", "file1Str", ...
// ComparePDFFiles reads and compares the full contents of the two specified // files byte-for-byte. Nil is returned if the file contents are equal, or if // the second file is missing, otherwise an error.
[ "ComparePDFFiles", "reads", "and", "compares", "the", "full", "contents", "of", "the", "two", "specified", "files", "byte", "-", "for", "-", "byte", ".", "Nil", "is", "returned", "if", "the", "file", "contents", "are", "equal", "or", "if", "the", "second",...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/compare.go#L133-L146
21,890
jung-kurt/gofpdf
def.go
GobEncode
func (info *ImageInfoType) GobEncode() (buf []byte, err error) { fields := []interface{}{info.data, info.smask, info.n, info.w, info.h, info.cs, info.pal, info.bpc, info.f, info.dp, info.trns, info.scale, info.dpi} w := new(bytes.Buffer) encoder := gob.NewEncoder(w) for j := 0; j < len(fields) && err == nil; j++ ...
go
func (info *ImageInfoType) GobEncode() (buf []byte, err error) { fields := []interface{}{info.data, info.smask, info.n, info.w, info.h, info.cs, info.pal, info.bpc, info.f, info.dp, info.trns, info.scale, info.dpi} w := new(bytes.Buffer) encoder := gob.NewEncoder(w) for j := 0; j < len(fields) && err == nil; j++ ...
[ "func", "(", "info", "*", "ImageInfoType", ")", "GobEncode", "(", ")", "(", "buf", "[", "]", "byte", ",", "err", "error", ")", "{", "fields", ":=", "[", "]", "interface", "{", "}", "{", "info", ".", "data", ",", "info", ".", "smask", ",", "info",...
// GobEncode encodes the receiving image to a byte slice.
[ "GobEncode", "encodes", "the", "receiving", "image", "to", "a", "byte", "slice", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/def.go#L190-L202
21,891
jung-kurt/gofpdf
def.go
PointToUnitConvert
func (f *Fpdf) PointToUnitConvert(pt float64) (u float64) { return pt / f.k }
go
func (f *Fpdf) PointToUnitConvert(pt float64) (u float64) { return pt / f.k }
[ "func", "(", "f", "*", "Fpdf", ")", "PointToUnitConvert", "(", "pt", "float64", ")", "(", "u", "float64", ")", "{", "return", "pt", "/", "f", ".", "k", "\n", "}" ]
// PointToUnitConvert is an alias for PointConvert.
[ "PointToUnitConvert", "is", "an", "alias", "for", "PointConvert", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/def.go#L228-L230
21,892
jung-kurt/gofpdf
def.go
Extent
func (info *ImageInfoType) Extent() (wd, ht float64) { return info.Width(), info.Height() }
go
func (info *ImageInfoType) Extent() (wd, ht float64) { return info.Width(), info.Height() }
[ "func", "(", "info", "*", "ImageInfoType", ")", "Extent", "(", ")", "(", "wd", ",", "ht", "float64", ")", "{", "return", "info", ".", "Width", "(", ")", ",", "info", ".", "Height", "(", ")", "\n", "}" ]
// Extent returns the width and height of the image in the units of the Fpdf // object.
[ "Extent", "returns", "the", "width", "and", "height", "of", "the", "image", "in", "the", "units", "of", "the", "Fpdf", "object", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/def.go#L242-L244
21,893
jung-kurt/gofpdf
def.go
Width
func (info *ImageInfoType) Width() float64 { return info.w / (info.scale * info.dpi / 72) }
go
func (info *ImageInfoType) Width() float64 { return info.w / (info.scale * info.dpi / 72) }
[ "func", "(", "info", "*", "ImageInfoType", ")", "Width", "(", ")", "float64", "{", "return", "info", ".", "w", "/", "(", "info", ".", "scale", "*", "info", ".", "dpi", "/", "72", ")", "\n", "}" ]
// Width returns the width of the image in the units of the Fpdf object.
[ "Width", "returns", "the", "width", "of", "the", "image", "in", "the", "units", "of", "the", "Fpdf", "object", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/def.go#L247-L249
21,894
jung-kurt/gofpdf
def.go
Height
func (info *ImageInfoType) Height() float64 { return info.h / (info.scale * info.dpi / 72) }
go
func (info *ImageInfoType) Height() float64 { return info.h / (info.scale * info.dpi / 72) }
[ "func", "(", "info", "*", "ImageInfoType", ")", "Height", "(", ")", "float64", "{", "return", "info", ".", "h", "/", "(", "info", ".", "scale", "*", "info", ".", "dpi", "/", "72", ")", "\n", "}" ]
// Height returns the height of the image in the units of the Fpdf object.
[ "Height", "returns", "the", "height", "of", "the", "image", "in", "the", "units", "of", "the", "Fpdf", "object", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/def.go#L252-L254
21,895
jung-kurt/gofpdf
def.go
generateFontID
func generateFontID(fdt fontDefType) (string, error) { // file can be different if generated in different instance fdt.File = "" b, err := json.Marshal(&fdt) return fmt.Sprintf("%x", sha1.Sum(b)), err }
go
func generateFontID(fdt fontDefType) (string, error) { // file can be different if generated in different instance fdt.File = "" b, err := json.Marshal(&fdt) return fmt.Sprintf("%x", sha1.Sum(b)), err }
[ "func", "generateFontID", "(", "fdt", "fontDefType", ")", "(", "string", ",", "error", ")", "{", "// file can be different if generated in different instance", "fdt", ".", "File", "=", "\"", "\"", "\n", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "&", ...
// generateFontID generates a font Id from the font definition
[ "generateFontID", "generates", "a", "font", "Id", "from", "the", "font", "definition" ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/def.go#L703-L708
21,896
jung-kurt/gofpdf
ttfparser.go
TtfParse
func TtfParse(fileStr string) (TtfRec TtfType, err error) { var t ttfParser t.f, err = os.Open(fileStr) if err != nil { return } version, err := t.ReadStr(4) if err != nil { return } if version == "OTTO" { err = fmt.Errorf("fonts based on PostScript outlines are not supported") return } if version != ...
go
func TtfParse(fileStr string) (TtfRec TtfType, err error) { var t ttfParser t.f, err = os.Open(fileStr) if err != nil { return } version, err := t.ReadStr(4) if err != nil { return } if version == "OTTO" { err = fmt.Errorf("fonts based on PostScript outlines are not supported") return } if version != ...
[ "func", "TtfParse", "(", "fileStr", "string", ")", "(", "TtfRec", "TtfType", ",", "err", "error", ")", "{", "var", "t", "ttfParser", "\n", "t", ".", "f", ",", "err", "=", "os", ".", "Open", "(", "fileStr", ")", "\n", "if", "err", "!=", "nil", "{"...
// TtfParse extracts various metrics from a TrueType font file.
[ "TtfParse", "extracts", "various", "metrics", "from", "a", "TrueType", "font", "file", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/ttfparser.go#L60-L99
21,897
jung-kurt/gofpdf
label.go
niceNum
func niceNum(val float64, round bool) float64 { var nf float64 exp := int(math.Floor(math.Log10(val))) f := val / math.Pow10(exp) if round { switch { case f < 1.5: nf = 1 case f < 3.0: nf = 2 case f < 7.0: nf = 5 default: nf = 10 } } else { switch { case f <= 1: nf = 1 case f <= 2...
go
func niceNum(val float64, round bool) float64 { var nf float64 exp := int(math.Floor(math.Log10(val))) f := val / math.Pow10(exp) if round { switch { case f < 1.5: nf = 1 case f < 3.0: nf = 2 case f < 7.0: nf = 5 default: nf = 10 } } else { switch { case f <= 1: nf = 1 case f <= 2...
[ "func", "niceNum", "(", "val", "float64", ",", "round", "bool", ")", "float64", "{", "var", "nf", "float64", "\n\n", "exp", ":=", "int", "(", "math", ".", "Floor", "(", "math", ".", "Log10", "(", "val", ")", ")", ")", "\n", "f", ":=", "val", "/",...
// niceNum returns a "nice" number approximately equal to x. The number is // rounded if round is true, converted to its ceiling otherwise.
[ "niceNum", "returns", "a", "nice", "number", "approximately", "equal", "to", "x", ".", "The", "number", "is", "rounded", "if", "round", "is", "true", "converted", "to", "its", "ceiling", "otherwise", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/label.go#L30-L59
21,898
jung-kurt/gofpdf
label.go
TickmarkPrecision
func TickmarkPrecision(div float64) int { return int(math.Max(-math.Floor(math.Log10(div)), 0)) }
go
func TickmarkPrecision(div float64) int { return int(math.Max(-math.Floor(math.Log10(div)), 0)) }
[ "func", "TickmarkPrecision", "(", "div", "float64", ")", "int", "{", "return", "int", "(", "math", ".", "Max", "(", "-", "math", ".", "Floor", "(", "math", ".", "Log10", "(", "div", ")", ")", ",", "0", ")", ")", "\n", "}" ]
// TickmarkPrecision returns an appropriate precision value for label // formatting.
[ "TickmarkPrecision", "returns", "an", "appropriate", "precision", "value", "for", "label", "formatting", "." ]
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/label.go#L63-L65
21,899
jung-kurt/gofpdf
label.go
Tickmarks
func Tickmarks(min, max float64) (list []float64, precision int) { if max > min { spread := niceNum(max-min, false) d := niceNum((spread / 4), true) graphMin := math.Floor(min/d) * d graphMax := math.Ceil(max/d) * d precision = TickmarkPrecision(d) for x := graphMin; x < graphMax+0.5*d; x += d { list = ...
go
func Tickmarks(min, max float64) (list []float64, precision int) { if max > min { spread := niceNum(max-min, false) d := niceNum((spread / 4), true) graphMin := math.Floor(min/d) * d graphMax := math.Ceil(max/d) * d precision = TickmarkPrecision(d) for x := graphMin; x < graphMax+0.5*d; x += d { list = ...
[ "func", "Tickmarks", "(", "min", ",", "max", "float64", ")", "(", "list", "[", "]", "float64", ",", "precision", "int", ")", "{", "if", "max", ">", "min", "{", "spread", ":=", "niceNum", "(", "max", "-", "min", ",", "false", ")", "\n", "d", ":=",...
// Tickmarks returns a slice of tickmarks appropriate for a chart axis and an // appropriate precision for formatting purposes. The values min and max will // be contained within the tickmark range.
[ "Tickmarks", "returns", "a", "slice", "of", "tickmarks", "appropriate", "for", "a", "chart", "axis", "and", "an", "appropriate", "precision", "for", "formatting", "purposes", ".", "The", "values", "min", "and", "max", "will", "be", "contained", "within", "the"...
8b09ffb30d9a8716107d250631b3c580aa54ba04
https://github.com/jung-kurt/gofpdf/blob/8b09ffb30d9a8716107d250631b3c580aa54ba04/label.go#L70-L82