PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
FontCache::FontCacheKey Struct Reference

#include <FontCache.h>

Public Member Functions

bool operator< (const FontCacheKey &other) const
 Comparison operator for std::map ordering.
 
bool operator== (const FontCacheKey &other) const
 Equality operator for debugging/testing.
 

Public Attributes

std::string filename
 
int style
 
int size
 

Detailed Description

Cache key for font lookup (excludes color - that's the optimization!) Multiple PFont objects with same {filename, style, size} but different colors can share a single TTF_Font object since SDL_TTF applies colors at render time.

Definition at line 14 of file FontCache.h.

Member Function Documentation

◆ operator<()

bool FontCache::FontCacheKey::operator< ( const FontCacheKey other) const

Comparison operator for std::map ordering.

Definition at line 10 of file FontCache.cpp.

10 {
11 // Compare filename first (most discriminating)
12 if (filename != other.filename) {
13 return filename < other.filename;
14 }
15 // Then style
16 if (style != other.style) {
17 return style < other.style;
18 }
19 // Finally size
20 return size < other.size;
21}

References filename, size, and style.

◆ operator==()

bool FontCache::FontCacheKey::operator== ( const FontCacheKey other) const

Equality operator for debugging/testing.

Definition at line 23 of file FontCache.cpp.

23 {
24 return filename == other.filename &&
25 style == other.style &&
26 size == other.size;
27}

References filename, size, and style.

Member Data Documentation

◆ filename

std::string FontCache::FontCacheKey::filename

◆ size

◆ style


The documentation for this struct was generated from the following files: