LMMS
Loading...
Searching...
No Matches
juce::WindowsTypeface Class Reference
Inheritance diagram for juce::WindowsTypeface:
juce::Typeface juce::ReferenceCountedObject

Public Member Functions

 WindowsTypeface (const Font &font)
 WindowsTypeface (const void *data, size_t dataSize)
 ~WindowsTypeface ()
float getAscent () const
float getDescent () const
float getHeightToPointsFactor () const
float getStringWidth (const String &text)
void getGlyphPositions (const String &text, Array< int > &resultGlyphs, Array< float > &xOffsets)
bool getOutlineForGlyph (int glyphNumber, Path &glyphPath)
Public Member Functions inherited from juce::Typeface
const StringgetName () const noexcept
const StringgetStyle () const noexcept
 ~Typeface () override
virtual bool isSuitableForFont (const Font &) const
virtual EdgeTablegetEdgeTableForGlyph (int glyphNumber, const AffineTransform &transform, float fontHeight)
virtual bool isHinted () const
void applyVerticalHintingTransform (float fontHeight, Path &path)
Public Member Functions inherited from juce::ReferenceCountedObject
void incReferenceCount () noexcept
void decReferenceCount () noexcept
bool decReferenceCountWithoutDeleting () noexcept
int getReferenceCount () const noexcept

Private Member Functions

void loadFont ()
void createKerningPairs (HDC hdc, std::unordered_map< int, int > &glyphsForChars, float height)
float getKerning (HDC hdc, int glyph1, int glyph2)

Static Private Member Functions

static uint64 kerningPairIndex (int glyph1, int glyph2)
static int getGlyphForChar (HDC dc, std::unordered_map< int, int > &cache, juce_wchar character)
static int getGlyphWidth (HDC dc, std::unordered_map< int, int > &cache, int glyphNumber)
static int getGlyphWidth (HDC dc, int glyphNumber)

Private Attributes

HFONT fontH = {}
HGDIOBJ previousFontH = {}
HDC dc { CreateCompatibleDC (nullptr) }
TEXTMETRIC tm
HANDLE memoryFont = {}
float ascent = 1.0f
float heightToPointsFactor = 1.0f
int defaultGlyph = -1
int heightInPoints = 0
std::unordered_map< uint64, float > kerningPairs

Static Private Attributes

static const MAT2 identityMatrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } }

Additional Inherited Members

Public Types inherited from juce::Typeface
using Ptr = ReferenceCountedObjectPtr<Typeface>
Static Public Member Functions inherited from juce::Typeface
static Ptr createSystemTypefaceFor (const Font &font)
static Ptr createSystemTypefaceFor (const void *fontFileData, size_t fontFileDataSize)
static void setTypefaceCacheSize (int numFontsToCache)
static void clearTypefaceCache ()
static void scanFolderForFonts (const File &folder)
Protected Member Functions inherited from juce::Typeface
 Typeface (const String &name, const String &style) noexcept
Protected Member Functions inherited from juce::ReferenceCountedObject
 ReferenceCountedObject ()=default
 ReferenceCountedObject (const ReferenceCountedObject &) noexcept
 ReferenceCountedObject (ReferenceCountedObject &&) noexcept
ReferenceCountedObjectoperator= (const ReferenceCountedObject &) noexcept
ReferenceCountedObjectoperator= (ReferenceCountedObject &&) noexcept
virtual ~ReferenceCountedObject ()
void resetReferenceCount () noexcept
Static Protected Member Functions inherited from juce::Typeface
static Ptr getFallbackTypeface ()
Protected Attributes inherited from juce::Typeface
String name
String style

Constructor & Destructor Documentation

◆ WindowsTypeface() [1/2]

juce::WindowsTypeface::WindowsTypeface ( const Font & font)
inline

◆ WindowsTypeface() [2/2]

juce::WindowsTypeface::WindowsTypeface ( const void * data,
size_t dataSize )
inline

◆ ~WindowsTypeface()

juce::WindowsTypeface::~WindowsTypeface ( )
inline

Member Function Documentation

◆ createKerningPairs()

void juce::WindowsTypeface::createKerningPairs ( HDC hdc,
std::unordered_map< int, int > & glyphsForChars,
float height )
inlineprivate

◆ getAscent()

float juce::WindowsTypeface::getAscent ( ) const
inlinevirtual

Returns the ascent of the font, as a proportion of its height. The height is considered to always be normalised as 1.0, so this will be a value less that 1.0, indicating the proportion of the font that lies above its baseline.

Implements juce::Typeface.

◆ getDescent()

float juce::WindowsTypeface::getDescent ( ) const
inlinevirtual

Returns the descent of the font, as a proportion of its height. The height is considered to always be normalised as 1.0, so this will be a value less that 1.0, indicating the proportion of the font that lies below its baseline.

Implements juce::Typeface.

◆ getGlyphForChar()

int juce::WindowsTypeface::getGlyphForChar ( HDC dc,
std::unordered_map< int, int > & cache,
juce_wchar character )
inlinestaticprivate

◆ getGlyphPositions()

void juce::WindowsTypeface::getGlyphPositions ( const String & text,
Array< int > & glyphs,
Array< float > & xOffsets )
inlinevirtual

Converts a line of text into its glyph numbers and their positions. The distances returned are based on the font having an normalised height of 1.0. You should never need to call this directly! Use Font::getGlyphPositions() instead!

Implements juce::Typeface.

◆ getGlyphWidth() [1/2]

int juce::WindowsTypeface::getGlyphWidth ( HDC dc,
int glyphNumber )
inlinestaticprivate

◆ getGlyphWidth() [2/2]

int juce::WindowsTypeface::getGlyphWidth ( HDC dc,
std::unordered_map< int, int > & cache,
int glyphNumber )
inlinestaticprivate

◆ getHeightToPointsFactor()

float juce::WindowsTypeface::getHeightToPointsFactor ( ) const
inlinevirtual

Returns the value by which you should multiply a JUCE font-height value to convert it to the equivalent point-size.

Implements juce::Typeface.

◆ getKerning()

float juce::WindowsTypeface::getKerning ( HDC hdc,
int glyph1,
int glyph2 )
inlineprivate

◆ getOutlineForGlyph()

bool juce::WindowsTypeface::getOutlineForGlyph ( int glyphNumber,
Path & path )
inlinevirtual

Returns the outline for a glyph. The path returned will be normalised to a font height of 1.0.

Implements juce::Typeface.

◆ getStringWidth()

float juce::WindowsTypeface::getStringWidth ( const String & text)
inlinevirtual

Measures the width of a line of text. The distance returned is based on the font having an normalised height of 1.0. You should never need to call this directly! Use Font::getStringWidth() instead!

Implements juce::Typeface.

◆ kerningPairIndex()

uint64 juce::WindowsTypeface::kerningPairIndex ( int glyph1,
int glyph2 )
inlinestaticprivate

◆ loadFont()

void juce::WindowsTypeface::loadFont ( )
inlineprivate

Member Data Documentation

◆ ascent

float juce::WindowsTypeface::ascent = 1.0f
private

◆ dc

HDC juce::WindowsTypeface::dc { CreateCompatibleDC (nullptr) }
private

◆ defaultGlyph

int juce::WindowsTypeface::defaultGlyph = -1
private

◆ fontH

HFONT juce::WindowsTypeface::fontH = {}
private

◆ heightInPoints

int juce::WindowsTypeface::heightInPoints = 0
private

◆ heightToPointsFactor

float juce::WindowsTypeface::heightToPointsFactor = 1.0f
private

◆ identityMatrix

const MAT2 juce::WindowsTypeface::identityMatrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } }
staticprivate

◆ kerningPairs

std::unordered_map<uint64, float> juce::WindowsTypeface::kerningPairs
private

◆ memoryFont

HANDLE juce::WindowsTypeface::memoryFont = {}
private

◆ previousFontH

HGDIOBJ juce::WindowsTypeface::previousFontH = {}
private

◆ tm

TEXTMETRIC juce::WindowsTypeface::tm
private

The documentation for this class was generated from the following file: