unipdf/pdf/creator/text_style.go

48 lines
1.0 KiB
Go
Raw Normal View History

2018-09-23 17:58:18 +03:00
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.md', which is part of this source code package.
*/
package creator
import (
"github.com/unidoc/unipdf/v3/pdf/model"
2018-09-23 17:58:18 +03:00
)
// TextStyle is a collection of properties that can be assigned to a chunk of text.
type TextStyle struct {
// The color of the text.
Color Color
// The font the text will use.
Font *model.PdfFont
2018-09-23 17:58:18 +03:00
// The size of the font.
FontSize float64
// The character spacing.
CharSpacing float64
// The rendering mode.
RenderingMode TextRenderingMode
2018-09-23 17:58:18 +03:00
}
// newTextStyle creates a new text style object using the specified font.
func newTextStyle(font *model.PdfFont) TextStyle {
2018-09-23 17:58:18 +03:00
return TextStyle{
Color: ColorRGBFrom8bit(0, 0, 0),
Font: font,
FontSize: 10,
}
}
2018-11-30 18:45:48 +02:00
// newLinkStyle creates a new text style object which can be
// used for link annotations.
func newLinkStyle(font *model.PdfFont) TextStyle {
return TextStyle{
Color: ColorRGBFrom8bit(0, 0, 238),
Font: font,
FontSize: 10,
}
}