bitmap

package
v0.0.0-...-b7ff752 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2023 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Overview

Package bitmap provides support for bitmap fonts found in .pcf files.

Index

Constants

View Source
const (
	COMPRESSED_METRICS = 0x00000100
)

Variables

This section is empty.

Functions

func Load

func Load(file fonts.Resource) (fonts.Faces, error)

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

func Parse(file fonts.Resource) (*Font, error)

Parse parse a .pcf font file.

func (*Font) AscenderPDF

func (f *Font) AscenderPDF() int

AscenderPDF returns the /Ascent value for the PDF file

func (*Font) BoundingBoxPDF

func (f *Font) BoundingBoxPDF() string

BoundingBoxPDF returns the /FontBBox value for the PDF file

func (*Font) CMapPDF

func (f *Font) CMapPDF() string

CMapPDF returns a CMap string to be used in a PDF file

func (*Font) CapHeightPDF

func (f *Font) CapHeightPDF() int

CapHeightPDF returns the /CapHeight value for the PDF 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) DescenderPDF

func (f *Font) DescenderPDF() int

DescenderPDF returns the /Descent value for the PDF file

func (*Font) FlagsPDF

func (f *Font) FlagsPDF() int

FlagsPDF returns the /Flags value for the PDF file

func (*Font) FontHExtents

func (f *Font) FontHExtents() (fonts.FontExtents, bool)

func (*Font) FontVExtents

func (f *Font) FontVExtents() (fonts.FontExtents, bool)

func (*Font) GetAdvance

func (f *Font) GetAdvance(index gid) (int32, error)

func (*Font) GetBDFProperty

func (f *Font) GetBDFProperty(s string) Property

GetBDFProperty return a property from a bitmap font, or nil if it is not found.

func (*Font) GlyphData

func (f *Font) GlyphData(gid fonts.GID, xPpem, yPpem uint16) fonts.GlyphData

func (*Font) GlyphExtents

func (f *Font) GlyphExtents(gid fonts.GID, _, _ uint16) (fonts.GlyphExtents, bool)

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

func (f *Font) GlyphHOrigin(fonts.GID) (x, y int32, found bool)

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 (f *Font) GlyphName(gid fonts.GID) string

func (*Font) GlyphVOrigin

func (f *Font) GlyphVOrigin(gid fonts.GID) (x, y int32, found bool)

GlyphVOrigin is the same as `GlyphHOrigin`, but for vertical text segments.

func (*Font) HorizontalAdvance

func (f *Font) HorizontalAdvance(gid fonts.GID) float32

func (*Font) ItalicAnglePDF

func (f *Font) ItalicAnglePDF() int

ItalicAnglePDF returns the /ItalicAngle value for the PDF file

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) NamePDF

func (f *Font) NamePDF() string

NamePDF returns the PDF name of the font.

func (*Font) NominalGlyph

func (f *Font) NominalGlyph(r rune) (fonts.GID, bool)

func (*Font) PostscriptInfo

func (f *Font) PostscriptInfo() (fonts.PSInfo, bool)

func (*Font) PostscriptName

func (f *Font) PostscriptName() string

func (*Font) StemVPDF

func (f *Font) StemVPDF() int

StemVPDF returns the /StemV value for the PDF file

func (*Font) Subset

func (f *Font) Subset(codepoints []fonts.GID) error

Subset removes all data from the font except the one needed for the given code points.

func (Font) Upem

func (Font) Upem() uint16

func (*Font) VerticalAdvance

func (f *Font) VerticalAdvance(gid fonts.GID) float32

func (*Font) WidthsPDF

func (f *Font) WidthsPDF() string

WidthsPDF returns a width entry suitable for embedding in a PDF file.

func (*Font) WriteSubset

func (f *Font) WriteSubset(w io.Writer) error

WriteSubset writes a valid font to w that is suitable for including in PDF

func (*Font) XHeightPDF

func (f *Font) XHeightPDF() int

XHeightPDF returns the /XHeight value for the PDF file

type Int

type Int int32

type Property

type Property interface {
	// contains filtered or unexported methods
}

Property is either an `Atom` or an `Int`

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL