package bitmap
import "github.com/benoitkugler/textlayout/fonts/bitmap"
Pacakge bitmap provides support for bitmap fonts found in .pcf files.
Index ¶
- Constants
- func Load(file fonts.Resource) (fonts.Faces, error)
- func ScanFont(file fonts.Resource) ([]fonts.FontDescriptor, error)
- type Atom
- type Font
- func Parse(file fonts.Resource) (*Font, error)
- func (f *Font) Cmap() (fonts.Cmap, fonts.CmapEncoding)
- func (f *Font) FontHExtents() (fonts.FontExtents, bool)
- func (f *Font) FontVExtents() (fonts.FontExtents, bool)
- func (f *Font) GetAdvance(index gid) (int32, error)
- func (f *Font) GetBDFProperty(s string) Property
- func (f *Font) GlyphData(gid fonts.GID, xPpem, yPpem uint16) fonts.GlyphData
- func (f *Font) GlyphExtents(gid fonts.GID, _, _ uint16) (fonts.GlyphExtents, bool)
- func (f *Font) GlyphHOrigin(fonts.GID) (x, y int32, found bool)
- func (f *Font) GlyphName(gid fonts.GID) string
- func (f *Font) GlyphVOrigin(gid fonts.GID) (x, y int32, found bool)
- func (f *Font) HorizontalAdvance(gid fonts.GID) float32
- func (Font) LineMetric(fonts.LineMetric) (float32, bool)
- func (f *Font) LoadBitmaps() []fonts.BitmapSize
- func (f *Font) LoadMetrics() fonts.FaceMetrics
- func (f *Font) LoadSummary() (fonts.FontSummary, error)
- func (f *Font) NominalGlyph(r rune) (fonts.GID, bool)
- func (f *Font) PoscriptName() string
- func (f *Font) PostscriptInfo() (fonts.PSInfo, bool)
- func (Font) Upem() uint16
- func (f *Font) VerticalAdvance(gid fonts.GID) float32
- type Int
- type Property
Constants ¶
const (
COMPRESSED_METRICS = 0x00000100
)
Functions ¶
func Load ¶
Load implements fonts.FontLoader. When the error is `nil`, one (and only one) font is returned.
func ScanFont ¶
func ScanFont(file fonts.Resource) ([]fonts.FontDescriptor, error)
ScanFont lazily parse `file` to extract the information about the font. If no error occurs, the returned slice has always length 1.
Types ¶
type Atom ¶
type Atom string
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
func Parse ¶
Parse parse a .pcf font file.
func (*Font) Cmap ¶
func (f *Font) Cmap() (fonts.Cmap, fonts.CmapEncoding)
read the charset properties and build the cmap only unicode charmap is supported
func (*Font) FontHExtents ¶
func (f *Font) FontHExtents() (fonts.FontExtents, bool)
func (*Font) FontVExtents ¶
func (f *Font) FontVExtents() (fonts.FontExtents, bool)
func (*Font) GetAdvance ¶
func (*Font) GetBDFProperty ¶
GetBDFProperty return a property from a bitmap font, or nil if it is not found.
func (*Font) GlyphData ¶
func (*Font) GlyphExtents ¶
GlyphExtents retrieve the extents for a specified glyph, of false, if not available. `coords` is used by variable fonts, and is specified in normalized coordinates. For bitmap glyphs, the closest resolution to `xPpem` and `yPpem` is selected.
func (*Font) GlyphHOrigin ¶
GlyphHOrigin fetches the (X,Y) coordinates of the origin (in font units) for a glyph ID, for horizontal text segments. Returns `false` if not available.
func (*Font) GlyphName ¶
func (*Font) GlyphVOrigin ¶
GlyphVOrigin is the same as `GlyphHOrigin`, but for vertical text segments.
func (*Font) HorizontalAdvance ¶
func (Font) LineMetric ¶
func (Font) LineMetric(fonts.LineMetric) (float32, bool)
func (*Font) LoadBitmaps ¶
func (f *Font) LoadBitmaps() []fonts.BitmapSize
LoadBitmaps always returns a one element slice.
func (*Font) LoadMetrics ¶
func (f *Font) LoadMetrics() fonts.FaceMetrics
LoadMetrics returns the font object itself.
func (*Font) LoadSummary ¶
func (f *Font) LoadSummary() (fonts.FontSummary, error)
func (*Font) NominalGlyph ¶
func (*Font) PoscriptName ¶
func (*Font) PostscriptInfo ¶
func (Font) Upem ¶
func (*Font) VerticalAdvance ¶
type Int ¶
type Int int32
type Property ¶
type Property interface {
// contains filtered or unexported methods
}
Property is either an `Atom` or an `Int`
Source Files ¶
bitmap.go metrics.go pcf.go renderer.go
- Version
- v0.3.1 (latest)
- Published
- Nov 14, 2024
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 5 days ago –
Tools for package owners.