60 #define FONT_UNDERLINE 4 61 #define FONT_OVERSTRIKE 5 62 #define FONT_NUMFIELDS 6 67 #define XLFD_FOUNDRY 0 71 #define XLFD_SETWIDTH 4 72 #define XLFD_ADD_STYLE 5 73 #define XLFD_PIXEL_SIZE 6 74 #define XLFD_POINT_SIZE 7 75 #define XLFD_RESOLUTION_X 8 76 #define XLFD_RESOLUTION_Y 9 77 #define XLFD_SPACING 10 78 #define XLFD_AVERAGE_WIDTH 11 79 #define XLFD_REGISTRY 12 80 #define XLFD_ENCODING 13 81 #define XLFD_NUMFIELDS 14 // Number of fields in XLFD. 91 struct LayoutChunk_t {
97 Int_t fNumDisplayChars;
120 struct XLFDAttributes_t {
122 const char *fFoundry;
144 Int_t fDeletePending;
184 struct FontStateMap_t {
Int_t fNumKey;
const char *fStrKey; };
255 0, 0, 0, 0, 0, 0, 0,
'a',
'b',
't',
'n',
'v',
'f',
'r', 0
277 Error(
"GetFontMetrics",
"argument may not be 0");
300 if ((opt ==
"full") && fNamedHash) {
301 Printf(
"TGFont: %s, %s, ref cnt = %u",
302 fNamedHash->GetName(),
303 fFM.fFixed ?
"fixed" :
"prop", References());
305 Printf(
"TGFont: %s, %s, ref cnt = %u", fName.Data(),
306 fFM.fFixed ?
"fixed" :
"prop", References());
345 family = fFA.fFamily;
346 if (strncasecmp(family,
"itc ", 4) == 0) {
349 if ((strcasecmp(family,
"Arial") == 0)
350 || (strcasecmp(family,
"Geneva") == 0)) {
351 family =
"Helvetica";
352 }
else if ((strcasecmp(family,
"Times New Roman") == 0)
353 || (strcasecmp(family,
"New York") == 0)) {
355 }
else if ((strcasecmp(family,
"Courier New") == 0)
356 || (strcasecmp(family,
"Monaco") == 0)) {
358 }
else if (strcasecmp(family,
"AvantGarde") == 0) {
359 family =
"AvantGarde";
360 }
else if (strcasecmp(family,
"ZapfChancery") == 0) {
361 family =
"ZapfChancery";
362 }
else if (strcasecmp(family,
"ZapfDingbats") == 0) {
363 family =
"ZapfDingbats";
373 src = dest = (
char*)dst->
Data() + len;
375 for (; *src !=
'\0'; src++, dest++) {
376 while (isspace(
UChar_t(*src))) {
381 if ((upper != 0) && (islower(
UChar_t(*src)))) {
382 *dest = toupper(
UChar_t(*src));
388 family = (
char *) dst->
Data() + len;
390 if (family != (
char *) dst->
Data() + len) {
392 family = (
char *) dst->
Data() + len;
394 if (strcasecmp(family,
"NewCenturySchoolbook") == 0) {
396 dst->
Append(
"NewCenturySchlbk");
397 family = (
char *) dst->
Data() + len;
404 if (strcmp(family,
"Bookman") == 0) {
405 weightString =
"Light";
406 }
else if (strcmp(family,
"AvantGarde") == 0) {
407 weightString =
"Book";
408 }
else if (strcmp(family,
"ZapfChancery") == 0) {
409 weightString =
"Medium";
412 if ((strcmp(family,
"Bookman") == 0)
413 || (strcmp(family,
"AvantGarde") == 0)) {
414 weightString =
"Demi";
416 weightString =
"Bold";
426 if ((strcmp(family,
"Helvetica") == 0)
427 || (strcmp(family,
"Courier") == 0)
428 || (strcmp(family,
"AvantGarde") == 0)) {
429 slantString =
"Oblique";
431 slantString =
"Italic";
438 if ((slantString.
IsNull()) && (weightString.
IsNull())) {
439 if ((strcmp(family,
"Times") == 0)
440 || (strcmp(family,
"NewCenturySchlbk") == 0)
441 || (strcmp(family,
"Palatino") == 0)) {
450 return fFA.fPointsize;
490 if (maxLength <= 0) {
493 newX = curX = termX = 0;
495 sawNonSpace = !isspace(
UChar_t(*p));
501 if (newX > maxLength) {
527 if ((flags &
kTextPartialOK) && (numChars > 0) && (curX < maxLength)) {
540 if (term == source) {
550 return term - source;
568 numChars = strlen(
string);
570 MeasureChars(
string, numChars, 0, 0, &width);
583 numChars = strlen(
string);
585 width =
gVirtualX->TextWidth(fFontStruct,
string, numChars);
611 MeasureChars(
string, firstChar, 0, 0, &startX);
612 MeasureChars(
string, lastChar, 0, 0, &endX);
614 gVirtualX->FillRectangle(dst, gc, x + startX, y + fUnderlinePos,
616 (
UInt_t) fUnderlineHeight);
653 const char *start, *end, *special;
654 Int_t n,
y=0, charsThisChunk, maxChunks;
655 Int_t baseline,
h, curX, newX, maxWidth;
657 LayoutChunk_t *chunk;
662 Int_t maxLines, curLine, layoutHeight;
664 lineLengths = staticLineLengths;
667 h = fFM.fAscent + fFM.fDescent;
670 numChars = strlen(
string);
675 layout->
fFont =
this;
680 baseline = fFM.fAscent;
687 end =
string + numChars;
694 for (start =
string; start < end;) {
695 if (start >= special) {
698 for (special = start; special < end; special++) {
700 if ((*special ==
'\n') || (*special ==
'\r')) {
705 if (*special ==
'\t') {
716 if (start < special) {
717 charsThisChunk = MeasureChars(start, special - start,
718 wrapLength - curX, flags, &newX);
721 if (charsThisChunk > 0) {
722 chunk = NewChunk(layout, &maxChunks, start,
723 charsThisChunk, curX, newX, baseline);
725 start += charsThisChunk;
729 if ((start == special) && (special < end)) {
731 LayoutChunk_t *newchunk = 0;
734 if (*special ==
'\t') {
735 newX = curX + fTabWidth;
736 newX -= newX % fTabWidth;
737 newchunk = NewChunk(layout, &maxChunks, start, 1, curX, newX, baseline);
738 if (newchunk) newchunk->fNumDisplayChars = -1;
740 if ((start < end) && ((wrapLength <= 0) || (newX <= wrapLength))) {
749 newchunk = NewChunk(layout, &maxChunks, start, 1, curX, 1000000000, baseline);
750 if (newchunk) newchunk->fNumDisplayChars = -1;
760 while ((start < end) && isspace(
UChar_t(*start))) {
762 if ((*start ==
'\n') || (*start ==
'\r')) {
767 if (*start ==
'\t') {
777 charsThisChunk = start - (chunk->fStart + chunk->fNumChars);
778 if (charsThisChunk > 0) {
779 chunk->fNumChars += MeasureChars(chunk->fStart + chunk->fNumChars,
780 charsThisChunk, 0, 0, &chunk->fTotalWidth);
781 chunk->fTotalWidth += curX;
790 if (curX > maxWidth) {
797 if (curLine >= maxLines) {
800 newLengths =
new int[2 * maxLines];
801 memcpy((
void *) newLengths, lineLengths, maxLines *
sizeof (
int));
803 if (lineLengths != staticLineLengths) {
804 delete[] lineLengths;
806 lineLengths = newLengths;
809 lineLengths[curLine] = curX;
822 chunk = NewChunk(layout, &maxChunks, start, 0, curX, 1000000000, baseline);
823 chunk->fNumDisplayChars = -1;
833 if (chunk) y = chunk->fY;
837 if (chunk->fY != y) {
841 extra = maxWidth - lineLengths[curLine];
843 chunk->fX += extra / 2;
850 layout->
fWidth = maxWidth;
851 layoutHeight = baseline - fFM.fAscent;
860 layout->
fChunks =
new LayoutChunk_t[1];
861 layout->
fChunks[0].fStart = string;
862 layout->
fChunks[0].fNumChars = 0;
863 layout->
fChunks[0].fNumDisplayChars = -1;
865 layout->
fChunks[0].fY = fFM.fAscent;
866 layout->
fChunks[0].fTotalWidth = 0;
867 layout->
fChunks[0].fDisplayWidth = 0;
873 *height = layoutHeight;
875 if (lineLengths != staticLineLengths) {
876 delete[] lineLengths;
911 Int_t i, numDisplayChars, drawX;
912 LayoutChunk_t *chunk;
914 if (lastChar < 0) lastChar = 100000000;
917 for (i = 0; i < fNumChunks; i++) {
918 numDisplayChars = chunk->fNumDisplayChars;
919 if ((numDisplayChars > 0) && (firstChar < numDisplayChars)) {
920 if (firstChar <= 0) {
924 fFont->MeasureChars(chunk->fStart, firstChar, 0, 0, &drawX);
926 if (lastChar < numDisplayChars) numDisplayChars = lastChar;
927 fFont->DrawChars(dst, gc, chunk->fStart + firstChar, numDisplayChars - firstChar,
928 x + chunk->fX + drawX, y + chunk->fY);
930 firstChar -= chunk->fNumChars;
931 lastChar -= chunk->fNumChars;
933 if (lastChar <= 0)
break;
958 int xx, yy,
width, height;
960 if ((CharBbox(underline, &xx, &yy, &width, &height) != 0)
962 gVirtualX->FillRectangle(dst, gc, x + xx,
963 y + yy + fFont->fFM.fAscent + fFont->fUnderlinePos,
990 LayoutChunk_t *chunk, *last;
1002 last = chunk = fChunks;
1003 for (i = 0; i < fNumChunks; i++) {
1004 baseline = chunk->fY;
1005 if (y < baseline + fFont->fFM.fDescent) {
1006 if (x < chunk->fX) {
1010 return (chunk->fStart - fString);
1026 while ((i < fNumChunks) && (chunk->fY == baseline)) {
1027 if (x < chunk->fX + chunk->fTotalWidth) {
1031 if (chunk->fNumDisplayChars < 0) {
1036 return (chunk->fStart - fString);
1038 n = fFont->MeasureChars(chunk->fStart, chunk->fNumChars,
1040 return ((chunk->fStart + n - 1) - fString);
1051 pos = (last->fStart + last->fNumChars) - fString;
1052 if (i < fNumChunks) pos--;
1062 return ((last->fStart + last->fNumChars) - fString);
1096 LayoutChunk_t *chunk;
1097 Int_t i, xx = 0, ww = 0;
1105 for (i = 0; i < fNumChunks; i++) {
1106 if (chunk->fNumDisplayChars < 0) {
1109 ww = chunk->fTotalWidth;
1112 }
else if (index < chunk->fNumChars) {
1114 fFont->MeasureChars(chunk->fStart, index, 0, 0, &xx);
1118 fFont->MeasureChars(chunk->fStart + index, 1, 0, 0, &ww);
1122 index -= chunk->fNumChars;
1130 xx = chunk->fX + chunk->fTotalWidth;
1143 *y = chunk->fY - fFont->fFM.fAscent;
1146 *h = fFont->fFM.fAscent + fFont->fFM.fDescent;
1155 if (xx + ww > fWidth) {
1178 Int_t i,
x1,
x2, y1, y2, xDiff, yDiff,
dist, minDist, ascent, descent;
1179 LayoutChunk_t *chunk;
1181 ascent = fFont->fFM.fAscent;
1182 descent = fFont->fFM.fDescent;
1186 for (i = 0; i < fNumChunks; i++) {
1187 if (chunk->fStart[0] ==
'\n') {
1196 y1 = chunk->fY - ascent;
1197 x2 = chunk->fX + chunk->fDisplayWidth;
1198 y2 = chunk->fY + descent;
1202 }
else if (x >= x2) {
1210 }
else if (y >= y2) {
1215 if ((xDiff == 0) && (yDiff == 0)) {
1219 if ((dist < minDist) || !minDist) {
1245 LayoutChunk_t *chunk;
1246 Int_t left, top, right, bottom;
1261 for (i = 0; i < fNumChunks; i++) {
1262 if (chunk->fStart[0] ==
'\n') {
1271 y1 = chunk->fY - fFont->fFM.fAscent;
1272 x2 = chunk->fX + chunk->fDisplayWidth;
1273 y2 = chunk->fY + fFont->fFM.fDescent;
1275 if ((right < x1) || (left >= x2) || (bottom < y1) || (top >= y2)) {
1280 }
else if ((x1 < left) || (x2 >= right) || (y1 < top) || (y2 >= bottom)) {
1282 }
else if (result == -1) {
1323 LayoutChunk_t *chunk;
1324 Int_t i, j, used,
c, baseline;
1327 baseline = chunk->fY;
1331 for (i = 0; i < fNumChunks; i++) {
1332 if (baseline != chunk->fY) {
1336 baseline = chunk->fY;
1338 if (chunk->fNumDisplayChars <= 0) {
1339 if (chunk->fStart[0] ==
'\t') {
1344 for (j = 0; j < chunk->fNumDisplayChars; j++) {
1345 c =
UChar_t(chunk->fStart[j]);
1346 if ((c ==
'(') || (c ==
')') || (c ==
'\\') || (c < 0x20) || (c >=
UChar_t(0x7f))) {
1355 sprintf(buf + used,
"\\%03o", c);
1396 const char *start,
Int_t numChars,
1399 LayoutChunk_t *chunk;
1402 maxChunks = *maxPtr;
1404 if (maxChunks == 0) {
1409 chunk =
new LayoutChunk_t[maxChunks];
1416 *maxPtr = maxChunks;
1420 chunk->fStart = start;
1421 chunk->fNumChars = numChars;
1422 chunk->fNumDisplayChars = numChars;
1425 chunk->fTotalWidth = newX - curX;
1426 chunk->fDisplayWidth = newX - curX;
1449 const char *source,
Int_t numChars,
1457 for (i = 0; i < numChars; i++) {
1460 DrawChars(dst, gc, source, p - source, x, y);
1461 x +=
gVirtualX->TextWidth(fFontStruct, source, p - source);
1471 DrawChars(dst, gc, source, p - source, x, y);
1479 const char *source,
Int_t numChars,
1484 if ((x + (max_width * numChars) > 0x7fff)) {
1492 numChars = MeasureChars(source, numChars, 0x7fff - x, 0, &length);
1495 gVirtualX->DrawString(dst, gc, x, y, source, numChars);
1497 if (fFA.fUnderline != 0) {
1498 gVirtualX->FillRectangle(dst, gc, x, y + fUnderlinePos,
1502 if (fFA.fOverstrike != 0) {
1503 y -= fFM.fDescent + fFM.fAscent / 10;
1520 fNamedTable->SetOwner();
1523 fUidTable->SetOwner();
1545 if (!font || !*font) {
1546 Error(
"GetFont",
"argument may not be 0 or empty");
1557 TNamedFont *nf = (TNamedFont*)fNamedTable->FindObject(font);
1562 f = GetFontFromAttributes(&nf->fFA, 0);
1570 f = GetNativeFont(font, fixedDefault);
1576 if (!ParseFontName(font, &fa)) {
1583 f = GetFontFromAttributes(&fa, 0);
1687 s = FindStateString(gWeightMap, weight);
1692 s = FindStateString(gSlantMap, slant);
1697 return GetFont(tmp.
Data());
1713 TNamedFont *nf = (TNamedFont *) font->
fNamedHash;
1715 if ((nf->RemoveReference() == 0) && (nf->fDeletePending != 0)) {
1716 fNamedTable->Remove(nf);
1734 while ((f = (
TGFont*) next())) {
1751 while ((f = (
TGFont*) next())) {
1777 fUidTable->Add(obj);
1780 return (
const char *)obj->
GetName();
1793 const char *str = 0;
1812 str = FindStateString(gWeightMap, fa->
fWeight);
1816 str = FindStateString(gSlantMap, fa->
fSlant);
1829 int len = strlen(str)+1;
1830 result[i] =
new char[len];
1831 strlcpy(result[i], str, len);
1833 result[i] =
new char[20];
1834 snprintf(result[i], 20,
"%d", num);
1878 out <<
" TGFont *ufont; // will reflect user font changes" << std::endl;
1880 out <<
" ufont = gClient->GetFont(" << quote <<
GetName() << quote <<
");" << std::endl;
1899 while (*p && ((*p ==
' ') || (*p ==
'\t'))) {
1914 while (*p && (*p !=
'"')) {
1923 while (*p && (*p !=
' ') && (*p !=
'\t')) {
1952 XLFDAttributes_t xa;
1954 int len = strlen(
string)+1;
1955 char *str =
new char[len];
1956 strlcpy(str,
string, len);
1958 if (*str ==
'-' || *str ==
'*') {
1963 result = ParseXLFD(str, &xa);
1987 if ((errno == ERANGE) || (end == s)) {
1993 n = FindStateNum(gWeightMap, s);
1998 n = FindStateNum(gSlantMap, s);
2006 n = FindStateNum(gUnderlineMap, s);
2011 n = FindStateNum(gOverstrikeMap, s);
2046 memset(field,
'\0',
sizeof (field));
2049 if (*str ==
'-') str++;
2052 src = (
char*)ds.
Data();
2055 for (i = 0; *src !=
'\0'; src++) {
2057 *src = tolower(
UChar_t(*src));
2077 if (atoi(field[XLFD_ADD_STYLE]) != 0) {
2079 field[j + 1] = field[j];
2092 xa->fFoundry = GetUid(field[XLFD_FOUNDRY]);
2095 xa->fFA.fFamily = GetUid(field[XLFD_FAMILY]);
2098 xa->fFA.fWeight = FindStateNum(gXlfdgWeightMap, field[XLFD_WEIGHT]);
2101 xa->fSlant = FindStateNum(gXlfdSlantMap, field[XLFD_SLANT]);
2109 xa->fSetwidth = FindStateNum(gXlfdSetwidthMap, field[XLFD_SETWIDTH]);
2116 if (field[XLFD_POINT_SIZE][0] ==
'[') {
2126 xa->fFA.fPointsize = atoi(field[XLFD_POINT_SIZE] + 1);
2130 xa->fFA.fPointsize = strtol(field[XLFD_POINT_SIZE], &end, 0);
2131 if (errno == ERANGE || end == field[XLFD_POINT_SIZE]) {
2134 xa->fFA.fPointsize /= 10;
2141 if (field[XLFD_PIXEL_SIZE][0] ==
'[') {
2151 xa->fFA.fPointsize = atoi(field[XLFD_PIXEL_SIZE] + 1);
2155 xa->fFA.fPointsize = strtol(field[XLFD_PIXEL_SIZE], &end, 0);
2156 if (errno == ERANGE || end == field[XLFD_PIXEL_SIZE]) {
2161 xa->fFA.fPointsize = -xa->fFA.fPointsize;
2172 xa->fCharset = FindStateNum(gXlfdCharsetMap, field[XLFD_REGISTRY]);
2175 xa->fEncoding = atoi(field[XLFD_ENCODING]);
2191 const FontStateMap_t *
m;
2193 if (!map->fStrKey) {
2197 for (m = map; m->fStrKey != 0; m++) {
2198 if (strcasecmp(strKey, m->fStrKey) == 0) {
2214 for ( ; map->fStrKey != 0; map++) {
2215 if (numKey == map->fNumKey)
return map->fStrKey;
2240 return (ch !=
'*' && ch !=
'?');
2261 char *family, *end, *p;
2271 nameList =
gVirtualX->ListFonts(
"*", 10000, numNames);
2273 for (i = 0; i < numNames; i++) {
2274 if (nameList[i][0] !=
'-') {
2277 family = strchr(nameList[i] + 1,
'-');
2282 end = strchr(family,
'-');
2287 for (p = family; *p !=
'\0'; p++) {
2298 dst =
new char*[entries+1];
2300 TIter next(&familyTable);
2304 while ((obj = next())) {
2323 for (i = 0; f[i] != 0; ++i) {
2342 Int_t numNames, score, i, scaleable, pixelsize, xaPixelsize;
2343 Int_t bestIdx, bestScore, bestScaleableIdx, bestScaleableScore;
2344 XLFDAttributes_t xa;
2349 const char *fmt, *family;
2357 if (pixelsize < 0) {
2359 d = -pixelsize * 25.4/72;
2366 pixelsize = (int) d;
2373 fmt =
"-*-%.240s-*-*-*-*-*-*-*-*-*-*-*-*";
2375 nameList =
gVirtualX->ListFonts(buf.
Data(), 32768, numNames);
2382 nameList =
gVirtualX->ListFonts(buf.
Data(), 32768, numNames);
2387 fontStruct =
gVirtualX->LoadQueryFont(
"fixed");
2390 fontStruct =
gVirtualX->LoadQueryFont(
"*");
2404 bestScaleableIdx = 0;
2407 for (i = 0; i < numNames; i++) {
2410 if (!ParseXLFD(nameList[i], &xa)) {
2413 xaPixelsize = -xa.fFA.fPointsize;
2420 if (xa.fFoundry && (strcasecmp(xa.fFoundry,
"adobe") != 0)) {
2423 if (!xa.fFA.fPointsize) {
2434 if (xaPixelsize > pixelsize) {
2435 score += (xaPixelsize - pixelsize) * 120;
2437 score += (pixelsize - xaPixelsize) * 100;
2464 if ((xa.fCharset ==
kFontCSNormal) && (xa.fEncoding != 1)) {
2472 if (score < bestScaleableScore) {
2473 bestScaleableIdx = i;
2474 bestScaleableScore = score;
2477 if (score < bestScore) {
2495 if (bestScaleableScore < bestScore) {
2501 str = nameList[bestScaleableIdx];
2503 str = strchr(str + 1,
'-');
2507 rest = strchr(rest + 1,
'-');
2510 buf =
TString::Format(
"%.240s-*-%d-*-*-*-*-*%s", nameList[bestScaleableIdx], pixelsize, rest);
2516 buf = nameList[bestIdx];
2524 if (bestScaleableScore <
kMaxInt) {
2535 font = MakeFont(fontPtr, fontStruct, buf);
2554 fixedDefault = fixedDefault && ((*name ==
'-') || (*name ==
'*'));
2555 fontStruct = fClient->GetFontByName(name, fixedDefault);
2561 return MakeFont(0, fontStruct, name);
2577 const char *fontName)
2581 Int_t i,
width, firstChar, lastChar,
n, replaceOK;
2584 XLFDAttributes_t xa;
2590 newFont =
new TGFont(fontName);
2593 if (!ParseXLFD(fontName, &xa)) {
2596 newFont->
fFA = xa.fFA;
2612 gVirtualX->GetFontProperties(fontStruct, ascent, descent);
2627 for (i = 0; i < 256; i++) {
2628 if ((i == 160) || (i == 173) || (i == 177) ||
2629 (i < firstChar) || (i > lastChar)) {
2641 char ch[2] = {0, 0};
2643 for (i = 0; i < 256; i++) {
2648 n =
gVirtualX->TextWidth(fontStruct, ch, 1);
2654 }
else if (width != n) {
2672 for (i = 0; i < 256; i++) {
void ToPostscript(TString *dst) const
Outputs the contents of a text layout in Postscript format.
Int_t CharBbox(Int_t index, Int_t *x, Int_t *y, Int_t *w, Int_t *h) const
Use the information in the TGTextLayout token to return the bounding box for the character specified ...
virtual const char * GetName() const
Returns name of object.
std::string GetName(const std::string &scope_name)
void DrawChars(Drawable_t dst, GContext_t gc, const char *source, Int_t numChars, Int_t x, Int_t y) const
Perform a quick sanity check to ensure we won't overflow the X coordinate space.
char ** GetFontFamilies()
Return information about the font families that are available on the current display.
double dist(Rotation3D const &r1, Rotation3D const &r2)
void Print(Option_t *option="") const
List all fonts in the pool.
Int_t PostscriptFontName(TString *dst) const
Return the name of the corresponding Postscript font for this TGFont.
static const FontStateMap_t gXlfdgWeightMap[]
void FreeFontFamilies(char **f)
Delete an array of families allocated GetFontFamilies() method.
Int_t XTextWidth(const char *string, Int_t numChars=-1) const
Return text widht in pixels.
TGFont * FindFont(FontStruct_t font) const
Find font based on its font struct. Returns 0 if font is not found.
virtual ~TGTextLayout()
destructor
R__EXTERN Int_t gErrorIgnoreLevel
void DrawCharsExp(Drawable_t dst, GContext_t gc, const char *source, Int_t numChars, Int_t x, Int_t y) const
Draw a string of characters on the screen.
Collectable string class.
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
const char * NameOfFont(TGFont *font)
Given a font, return a textual string identifying it.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TGFont * MakeFont(TGFont *font, FontStruct_t fontStruct, const char *fontName)
Helper for GetNativeFont() and GetFontFromAttributes().
Definitions for TRefCnt, base class for reference counted objects.
virtual Int_t GetEntries() const
void DrawText(Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) const
Use the information in the TGTextLayout object to display a multi-line, justified string of text...
Int_t PointToChar(Int_t x, Int_t y) const
Use the information in the TGTextLayout token to determine the character closest to the given point...
static const FontStateMap_t gSlantMap[]
char ** GetAttributeInfo(const FontAttributes_t *fa)
Return information about the font attributes as an array of strings.
int FindStateNum(const FontStateMap_t *map, const char *strKey)
Given a lookup table, map a string to a number in the table.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save the used font as a C++ statement(s) on output stream out.
void FreeAttributeInfo(char **info)
Free attributes info.
TGFont * GetFontFromAttributes(FontAttributes_t *fa, TGFont *fontPtr)
Given a desired set of attributes for a font, find a font with the closest matching attributes and cr...
TGFont * GetNativeFont(const char *name, Bool_t fixedDefault=kTRUE)
The return value is a pointer to an TGFont object that represents the native font.
static const double x2[5]
THashTable implements a hash table to store TObject's.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Int_t TextWidth(const char *string, Int_t numChars=-1) const
A wrapper function for the more complicated interface of MeasureChars.
static const FontStateMap_t gXlfdCharsetMap[]
TString & Append(const char *cs)
static const FontStateMap_t gXlfdSlantMap[]
Int_t DistanceToText(Int_t x, Int_t y) const
Computes the distance in pixels from the given point to the given text layout.
Bool_t FieldSpecified(const char *field)
Helper function for ParseXLFD().
virtual ~TGFont()
Delete font.
void Error(const char *location, const char *msgfmt,...)
Int_t IntersectText(Int_t x, Int_t y, Int_t w, Int_t h) const
Determines whether a text layout lies entirely inside, entirely outside, or overlaps a given rectangl...
void UnderlineChar(Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t underline) const
Use the information in the TGTextLayout object to display an underline below an individual character...
const char * GetName() const
Returns name of object.
void SetRefCount(UInt_t r)
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void FreeFont(const TGFont *font)
Free font. If ref count is 0 delete font.
virtual ~TGFontPool()
Cleanup font pool.
static const FontStateMap_t gXlfdSetwidthMap[]
TGFontPool(const TGFontPool &fp)
static const FontStateMap_t gUnderlineMap[]
char * StrDup(const char *str)
Duplicate the string str.
Bool_t ParseFontName(const char *string, FontAttributes_t *fa)
Converts a string into a set of font attributes that can be used to construct a font.
Bool_t ParseXLFD(const char *string, XLFDAttributes_t *xa)
Break up a fully specified XLFD into a set of font attributes.
void Print(Option_t *option="") const
Print font info.
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get the specified font.
static const FontStateMap_t gWeightMap[]
TObject * FindObject(const char *name) const
Find object using its name.
static const double x1[5]
static char * GetToken(char *str)
static RooMathCoreReg dummy
TGTextLayout * ComputeTextLayout(const char *string, Int_t numChars, Int_t wrapLength, Int_t justify, Int_t flags, UInt_t *width, UInt_t *height) const
Computes the amount of screen space needed to display a multi-line, justified string of text...
void Add(TObject *obj)
Add object to the hash table.
static constexpr double s
Double_t Hypot(Double_t x, Double_t y)
Mother of all ROOT objects.
Int_t MeasureChars(const char *source, Int_t numChars, Int_t maxLength, Int_t flags, Int_t *length) const
Determine the number of characters from the string that will fit in the given horizontal span...
TGFont * FindFontByHandle(FontH_t font) const
Find font based on its font handle. Returns 0 if font is not found.
static int GetControlCharSubst(int c, char buf[4])
When displaying text in a widget, a backslashed escape sequence is substituted for control characters...
const char * FindStateString(const FontStateMap_t *map, int numKey)
Given a lookup table, map a number to a string in the table.
#define dest(otri, vertexptr)
FontStruct_t operator()() const
Not inline due to a bug in g++ 2.96 20000731 (Red Hat Linux 7.0)
void GetFontMetrics(FontMetrics_t *m) const
Get font metrics.
void UnderlineChars(Drawable_t dst, GContext_t gc, const char *string, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) const
This procedure draws an underline for a given range of characters in a given string.
static const FontStateMap_t gOverstrikeMap[]
virtual const char * GetName() const
Returns name of object.
const char * GetUid(const char *string)
Given a string, this procedure returns a unique identifier for the string.
LayoutChunk_t * NewChunk(TGTextLayout *layout, int *maxPtr, const char *start, int numChars, int curX, int newX, int y) const
Helper function for ComputeTextLayout().
const char * Data() const