mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +08:00
Use default creator font on paragraph initialization
This commit is contained in:
parent
bb1c49abe8
commit
fcbf07458b
@ -72,32 +72,21 @@ type Paragraph struct {
|
|||||||
// Standard font may will have an encdoing set to WinAnsiEncoding. To set a different encoding, make a new font
|
// Standard font may will have an encdoing set to WinAnsiEncoding. To set a different encoding, make a new font
|
||||||
// and use SetFont on the paragraph to override the defaut one.
|
// and use SetFont on the paragraph to override the defaut one.
|
||||||
func newParagraph(text string, style TextStyle) *Paragraph {
|
func newParagraph(text string, style TextStyle) *Paragraph {
|
||||||
// TODO(dennwc): style is unused
|
p := &Paragraph{
|
||||||
|
text: text,
|
||||||
p := &Paragraph{text: text}
|
textFont: style.Font,
|
||||||
|
fontSize: style.FontSize,
|
||||||
font, err := model.NewStandard14Font("Helvetica")
|
lineHeight: 1.0,
|
||||||
if err != nil {
|
enableWrap: true,
|
||||||
common.Log.Debug("ERROR: NewStandard14FontWithEncoding failed err=%v. Falling back.", err)
|
defaultWrap: true,
|
||||||
p.textFont = model.DefaultFont()
|
alignment: TextAlignmentLeft,
|
||||||
|
angle: 0,
|
||||||
|
scaleX: 1,
|
||||||
|
scaleY: 1,
|
||||||
|
positioning: positionRelative,
|
||||||
}
|
}
|
||||||
p.textFont = font
|
|
||||||
|
|
||||||
p.fontSize = 10
|
|
||||||
p.lineHeight = 1.0
|
|
||||||
|
|
||||||
// TODO: Can we wrap intellectually, only if given width is known?
|
|
||||||
p.enableWrap = true
|
|
||||||
p.defaultWrap = true
|
|
||||||
p.SetColor(ColorRGBFrom8bit(0, 0, 0))
|
|
||||||
p.alignment = TextAlignmentLeft
|
|
||||||
p.angle = 0
|
|
||||||
|
|
||||||
p.scaleX = 1
|
|
||||||
p.scaleY = 1
|
|
||||||
|
|
||||||
p.positioning = positionRelative
|
|
||||||
|
|
||||||
|
p.SetColor(style.Color)
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user