id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c21800
m", x*f.k, (f.h-y)*f.k) }
c21801
return f.alpha, f.blendMode }
c21802
styleStr = strings.ToUpper(styleStr) if styleStr == "IB" { styleStr = "BI" } return familyStr + styleStr }
c21803
} // dbg("font [%s], type [%s]", info.File, info.Tp) if len(info.File) > 0 { // Embedded font if info.Tp == "TrueType" { f.fontFiles[info.File] = fontFileType{length1: int64(info.OriginalSize)} } else { f.fontFiles[info.File] = fontFileType{length1: int64(info.Size1), length2: int64(info.Size2)} } } ...
c21804
} return f.fonts[getFontKey(familyStr, styleStr)].Desc }
c21805
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}) }
c21806
txtStr, level: level, y: y, p: f.PageNo(), prev: -1, last: -1, next: -1, first: -1}) }
c21807
txtStr, "", 0, "L", false, 0, "") }
c21808
sprintf(fmtStr, args...), "", 0, "L", false, 0, "") }
c21809
== '\n' || l > wmax { if sep == -1 { if i == j { i++ } sep = i } else { i = sep + 1 } lines = append(lines, s[j:sep]) sep = -1 j = i l = 0 } else { i++ } } if i != j { lines = append(lines, s[j:i]) } return lines }
c21810
} if i == j { i++ } f.CellFormat(w, h, s[j:i], "", 2, "", false, link, linkStr) } else { f.CellFormat(w, h, s[j:sep], "", 2, "", false, link, linkStr) i = sep + 1 } sep = -1 j = i l = 0.0 if nl == 1 { f.x = f.lMargin w = f.w - f.rMargin - f.x wmax = (w - 2*f.cMar...
c21811
f.write(h, sprintf(fmtStr, args...), 0, "") }
c21812
+= f.lasth } else { f.y += h } }
c21813
false, ImageType: tp, } return f.RegisterImageOptionsReader(imgName, options, r) }
c21814
{ return f.images[imageStr] }
c21815
} else { f.x = f.w + x } }
c21816
y >= 0 { f.y = y } else { f.y = f.h + y } }
c21817
f.SetX(f.lMargin) }
c21818
float64) { f.SetY(y) f.SetX(x) }
c21819
return } f.protect.setProtection(actionFlag, userPassStr, ownerPassStr) }
c21820
error { f.Output(w) w.Close() return f.err }
c21821
os.Create(fileStr) if err == nil { f.Output(pdfFile) pdfFile.Close() } else { f.err = err } } return f.err }
c21822
if f.state < 3 { f.Close() } _, err := f.buffer.WriteTo(w) if err != nil { f.err = err } return f.err }
c21823
err = json.Unmarshal(buf.Bytes(), &def) if err != nil { f.err = err return } if def.i, err = generateFontID(def); err != nil { f.err = err } // dump(def) return }
c21824
strings.Replace(s, "(", "\\(", -1) s = strings.Replace(s, ")", "\\)", -1) s = strings.Replace(s, "\r", "\\r", -1) return s }
c21825
s = string(b) } return "(" + f.escape(s) + ")" }
c21826
color.GrayModel: info.cs = "DeviceGray" case color.YCbCrModel: info.cs = "DeviceRGB" case color.CMYKModel: info.cs = "DeviceCMYK" default: f.err = fmt.Errorf("image JPEG buffer has unsupported color space (%v)", config.ColorModel) return } return }
c21827
f.err = err return } return f.parsepngstream(buf, readdpi) }
c21828
append(f.offsets, 0) } f.offsets[f.n] = f.buffer.Len() f.outf("%d 0 obj", f.n) }
c21829
f.buffer.WriteString(s) f.buffer.WriteString("\n") } }
c21830
f.pages[f.page].WriteString("\n") } else { f.buffer.ReadFrom(r) f.buffer.WriteString("\n") } }
c21831
...interface{}) { f.out(sprintf(fmtStr, args...)) }
c21832
^os.ModePerm&info.Mode() == 0 { ok = true } } return ok }
c21833
err := os.Stat(filename) ok = err == nil if ok { size = info.Size() } return }
c21834
b = new(bytes.Buffer) _, err = b.ReadFrom(r) return }
c21835
return false } for i := range a { if a[i] != b[i] { return false } } return true }
c21836
cmp.Write(data) cmp.Close() return buf.Bytes() }
c21837
defer r.Close() if err == nil { var outBuf bytes.Buffer _, err = outBuf.ReadFrom(r) if err == nil { outData = outBuf.Bytes() } } return }
c21838
int { if cnd { return a } return b }
c21839
string { if cnd { return aStr } return bStr }
c21840
fmt.Sscanf(lineStr, "!%2X U+%4X %s", &cPos, &uPos, &nameStr) if err == nil { if cPos >= 0x80 { m[rune(uPos)] = byte(cPos) } } } } if err == nil { f = repClosure(m) } else { f = doNothing } return }
c21841
fl, err = os.Open(fileStr) if err == nil { f, err = UnicodeTranslator(fl) fl.Close() } else { f = doNothing } return }
c21842
PointType{p.X + x, p.Y + y} }
c21843
SizeType{s.Wd * factor, s.Ht * factor} }
c21844
{ height := s.Ht * width / s.Wd return SizeType{width, height} }
c21845
{ width := s.Wd * height / s.Ht return SizeType{width, height} }
c21846
newTpl(PointType{0, 0}, f.curPageSize, f.defOrientation, f.unitStr, f.fontDirStr, fn, f) }
c21847
return newTpl(corner, size, f.defOrientation, f.unitStr, f.fontDirStr, fn, f) }
c21848
string, fn func(*Tpl)) Template { return newTpl(corner, size, orientationStr, unitStr, fontDirStr, fn, nil) }
c21849
size := t.Size() f.UseTemplateScaled(t, corner, size) }
c21850
name = sprintf("t%s-%s", t.ID(), name) f.images[name] = ti } // template data _, templateSize := t.Size() scaleX := size.Wd / templateSize.Wd scaleY := size.Ht / templateSize.Ht tx := corner.X * f.k ty := (f.curPageSize.Ht - corner.Y - size.Ht) * f.k f.outf("q %.4f 0 0 %.4f %.4f %.4f cm", scaleX, scaleY, ...
c21851
f.templateFontCatalog() tImages := t.Images() tTemplates := t.Templates() if len(tImages) > 0 || len(tTemplates) > 0 { f.out("/XObject <<") { var key string var keyList []string var ti *ImageInfoType for key = range tImages { keyList = append(keyList, key) } if gl.catalogSort ...
c21852
chain = append(chain, tt) } } } // reduce that to make a simple list sorted := make([]Template, 0, len(templates)) chain: for _, t := range chain { for _, already := range sorted { if t == already { continue chain } } sorted = append(sorted, t) } return sorted }
c21853
chain = append(chain, templateChainDependencies(req)...) } chain = append(chain, template) return chain }
c21854
k: byteBound(k), }, } } else { f.err = fmt.Errorf("name \"%s\" is already associated with a spot color", nameStr) } } }
c21855
c, m, y, k byte) { return f.returnSpotColor(f.color.draw) }
c21856
c, m, y, k byte) { return f.returnSpotColor(f.color.text) }
c21857
c, m, y, k byte) { return f.returnSpotColor(f.color.fill) }
c21858
&& id < len(f.layer.list) { f.outf("/OC /OC%d BDC", id) f.layer.currentLayer = id } }
c21859
f.out("EMC") f.layer.currentLayer = -1 } }
c21860
} return convertFrom96Dpi(pdf, float64(unscaled.Bounds().Dx())), convertFrom96Dpi(pdf, float64(unscaled.Bounds().Dy())) }
c21861
'E', -1, 64) yStr := strconv.FormatFloat(y, 'E', -1, 64) return "barcode-" + code + "-" + xStr + yStr }
c21862
{ return bcode.Metadata().CodeKind + bcode.Content() }
c21863
pdf.GetLineWidth() _, st.fontSize = pdf.GetFontSize() st.alpha, st.blendStr = pdf.GetAlpha() st.cellMargin = pdf.GetCellMargin() return }
c21864
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) pdf.SetCellMargin(st.cellMargin) }
c21865
strconv.FormatFloat(val, 'f', precision, 64) }
c21866
return g.xm*dataX + g.xb, g.ym*dataY + g.yb }
c21867
y = g.h*(1-yRel) + g.y return }
c21868
float64 { return g.xm*dataX + g.xb }
c21869
float64 { return g.ym*dataY + g.yb }
c21870
{ min = g.xTicks[0] max = g.xTicks[len(g.xTicks)-1] return }
c21871
{ min = g.yTicks[0] max = g.yTicks[len(g.yTicks)-1] return }
c21872
if htmlStr[cap[0]+1] == '/' { seg.Cat = 'C' seg.Str = strings.ToLower(htmlStr[cap[0]+2 : cap[1]-1]) seg.Attr = nil list = append(list, seg) } else { // Extract attributes parts = strings.Split(htmlStr[cap[0]+1:cap[1]-1], " ") if len(parts) > 0 { for j, part := range parts { if...
c21873
html.Link.ClrB = 0, 0, 128 html.Link.Bold, html.Link.Italic, html.Link.Underscore = false, false, true return }
c21874
float64(ttf.Xmax)), round(k * float64(ttf.Ymax)), } // printf("FontBBox\n") // dump(info.Desc.FontBBox) info.Desc.CapHeight = round(k * float64(ttf.CapHeight)) info.Desc.MissingWidth = round(k * float64(ttf.Widths[0])) var wd int for j := 0; j < len(info.Widths); j++ { wd = info.Desc.MissingWidth if encLi...
c21875
buf.printf("%d ", j) } last = j buf.printf("/%s ", encList[j].name) } } diffStr = strings.TrimSpace(buf.String()) return }
c21876
return fmt.Sprintf("%x", sha1.Sum(t.Bytes())) }
c21877
size SizeType) { return t.corner, t.size }
c21878
// if it is already pointing to the correct page // there is no need to create a new template if t.page == page { return t, nil } t2 := *t t2.page = page return &t2, nil }
c21879
{ // the only error is when accessing a // non existing template... that can't happen // here p[x-1], _ = t.FromPage(x) } return p }
c21880
err := enc.Encode(t) return b.Bytes(), err }
c21881
dec := gob.NewDecoder(bytes.NewBuffer(b)) err := dec.Decode(tpl) return tpl, err }
c21882
name := sprintf("t%s-%s", t.templates[x].ID(), key) childrenImgs[name] = val } } return childrenImgs }
c21883
:= t.templates[x].Templates() childrenTmpls = append(childrenTmpls, tmpls...) } return childrenTmpls }
c21884
firstClassImgs[key] = img } } if err == nil { err = encoder.Encode(firstClassImgs) } if err == nil { err = encoder.Encode(t.corner) } if err == nil { err = encoder.Encode(t.size) } if err == nil { err = encoder.Encode(t.bytes) } if err == nil { err = encoder.Encode(t.page) } return w.Bytes...
c21885
:= range firstClassImages { t.images[k] = v } if err == nil { err = decoder.Decode(&t.corner) } if err == nil { err = decoder.Decode(&t.size) } if err == nil { err = decoder.Decode(&t.bytes) } if err == nil { err = decoder.Decode(&t.page) } return err }
c21886
for j := len(list) - 1; j >= 0 && list[j] != "gofpdf"; j-- { gofpdfDir = filepath.Join(gofpdfDir, "..") } } else { panic(err) } }
c21887
!checkBytes(posStart, sl1[posStart:posEnd], sl2[posStart:posEnd], printDiff) { diffs = true } posStart = posEnd } if diffs { err = fmt.Errorf("documents are different") } return }
c21888
nil { err = CompareBytes(b1.Bytes(), b2.Bytes(), printDiff) } } return }
c21889
err = CompareBytes(sl1, sl2, printDiff) } else { // Second file is missing; treat this as success err = nil } } return }
c21890
j < len(fields) && err == nil; j++ { err = encoder.Encode(fields[j]) } if err == nil { buf = w.Bytes() } return }
c21891
float64) { return pt / f.k }
c21892
return info.Width(), info.Height() }
c21893
/ (info.scale * info.dpi / 72) }
c21894
/ (info.scale * info.dpi / 72) }
c21895
b, err := json.Marshal(&fdt) return fmt.Sprintf("%x", sha1.Sum(b)), err }
c21896
:= 0; j < numTables; j++ { tag, err = t.ReadStr(4) if err != nil { return } t.Skip(4) // checkSum offset := t.ReadULong() t.Skip(4) // length t.tables[tag] = offset } err = t.ParseComponents() if err != nil { return } t.f.Close() TtfRec = t.rec return }
c21897
nf = 10 } } else { switch { case f <= 1: nf = 1 case f <= 2.0: nf = 2 case f <= 5.0: nf = 5 default: nf = 10 } } return nf * math.Pow10(exp) }
c21898
{ return int(math.Max(-math.Floor(math.Log10(div)), 0)) }
c21899
precision = TickmarkPrecision(d) for x := graphMin; x < graphMax+0.5*d; x += d { list = append(list, x) } } return }