Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLFontBaseStore Class Reference

#include <G4OpenGLFontBaseStore.hh>

Classes

struct  FontInfo
 

Static Public Member Functions

static void AddFontBase (G4VViewer *, G4int fontBase, G4double size, const G4String &fontName, G4int width)
 
static const FontInfoGetFontInfo (G4VViewer *, G4double size)
 

Detailed Description

Definition at line 41 of file G4OpenGLFontBaseStore.hh.

Member Function Documentation

◆ AddFontBase()

void G4OpenGLFontBaseStore::AddFontBase ( G4VViewer * viewer,
G4int fontBase,
G4double size,
const G4String & fontName,
G4int width )
static

Definition at line 34 of file G4OpenGLFontBaseStore.cc.

37 {
38 fFontBaseMap[viewer].push_back(FontInfo(fontName, size, fontBase, width));
39}

Referenced by G4OpenGLXViewer::CreateFontLists().

◆ GetFontInfo()

const G4OpenGLFontBaseStore::FontInfo & G4OpenGLFontBaseStore::GetFontInfo ( G4VViewer * viewer,
G4double size )
static

Definition at line 42 of file G4OpenGLFontBaseStore.cc.

43 {
44 std::map<G4VViewer*,std::vector<FontInfo> >::const_iterator i =
45 fFontBaseMap.find(viewer);
46 if (i != fFontBaseMap.end()) {
47 G4double sizeDiscrepancy = 9999.;
48 std::vector<FontInfo>::const_iterator j, k;
49 for (j = i->second.begin(); j != i->second.end(); ++j) {
50 G4double d = std::abs(size - j->fSize);
51 if (d < sizeDiscrepancy) {
52 sizeDiscrepancy = d;
53 k = j;
54 }
55 }
56 return *k;
57 } else {
58 // No font found for requested viewer.
59 static const FontInfo nullFontInfo; // Default struct, fontBase = -1;
60 return nullFontInfo;
61 }
62}
double G4double
Definition G4Types.hh:83

Referenced by G4OpenGLXViewer::DrawText().


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