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 (
|
2019-05-16 23:44:51 +03:00
|
|
|
"github.com/unidoc/unipdf/v3/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.
|
2018-10-12 23:00:02 +03:00
|
|
|
Font *model.PdfFont
|
2018-09-23 17:58:18 +03:00
|
|
|
|
|
|
|
// The size of the font.
|
|
|
|
FontSize float64
|
2019-01-30 20:10:51 +02:00
|
|
|
|
2019-02-06 20:31:14 +02:00
|
|
|
// The character spacing.
|
|
|
|
CharSpacing float64
|
|
|
|
|
2019-01-30 20:10:51 +02:00
|
|
|
// The rendering mode.
|
|
|
|
RenderingMode TextRenderingMode
|
2018-09-23 17:58:18 +03:00
|
|
|
}
|
|
|
|
|
2018-10-12 23:00:02 +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,
|
|
|
|
}
|
|
|
|
}
|