,
54 "NimbusSanL-Bold.ttf",
55 "NimbusSanL-ReguItal.ttf",
56 "NimbusSanL-BoldItal.ttf",
57 "LucidaBrightRegular.ttf",
58 "LucidaBrightDemiBold.ttf",
59 "LucidaBrightItalic.ttf",
60 "LucidaBrightDemiItalic.ttf",
61 "NimbusMonL-Regu.ttf",
62 "NimbusMonL-Bold.ttf",
63 "NimbusMonL-ReguObli.ttf",
64 "NimbusMonL-BoldObli.ttf",
66 "dark-courier-bold.ttf",
67 "dark-courier-italic.ttf",
68 "dark-courier-bold-italic.ttf",
69 "NimbusRomanNo9-Reg.ttf",
70 "NimbusRomanNo9-Med.ttf",
71 "NimbusRomanNo9-Ita.ttf",
72 "NimbusRomanNo9-MedIta.ttf",
76 "BPmonoBoldStencil.ttf",
77 "LastFontDummy.NotAFile",
87 "Helvetica Bold Oblique",
91 "Lucida Bold Italic",
95 "Courier Bold Oblique",
99 "Fixed Bold Oblique",
102 "Times-Roman Italic",
103 "Times-Roman Bold Italic",
107 "BPMono Bold Stencil",
109 "Helvetica Bitmap 6",
110 "Helvetica Bitmap 8",
111 "Helvetica Bitmap 10" 1156, 7, 8, 9, 10, 11, 12, 14, 16, 18, 21, 24, 36, 48, 60, 72, 0
121, m_FontFace(eFontFace_LastFont)
123, m_Rotate(fFontRotateBase)
124, m_SnapToPixelX(
true)
125, m_SnapToPixelY(
true)
132 unsigned intfont_size)
134, m_FontFace(eFontFace_LastFont)
135, m_FontSize(font_size)
136, m_Rotate(fFontRotateBase)
137, m_SnapToPixelX(
true)
138, m_SnapToPixelY(
true)
141 SetFont(font_file_name, font_size);
145 unsigned intfont_size)
148, m_FontSize(font_size)
149, m_Rotate(fFontRotateBase)
150, m_SnapToPixelX(
true)
151, m_SnapToPixelY(
true)
177 if(font_file !=
"")
188 unsigned intfont_size,
189 booluse_bitmap_overrides)
195FTFont* font = fm.
GetFont(font_file_name.c_str(), font_size);
198 if(font==
NULL|| font->Error())
278gl.
Enable(GL_TEXTURE_2D);
279gl.
TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
291GLdouble* mview, GLdouble* proj )
const 330gl.
Enable(GL_TEXTURE_2D);
331gl.
TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
354gl.
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
362 const float*
color,
372 const float*
color,
388 boolreorient_text =
false;
391 boolbackwards = cos(
double(rads)) <
TModelUnit(0);
393reorient_text =
true;
416xi = floor(wx + 0.5);
418yi = floor(wy + 0.5);
435gl.
Translated((GLdouble)rcenterx, (GLdouble)rcentery, 0.0);
436gl.
Rotated(rotate_degrees, 0.0, 0.0, 1.0);
437gl.
Translated((GLdouble)-rcenterx, (GLdouble)-rcentery, 0.0);
443gl.
Scalef(1.0f, -1.0f, 1.0f);
445gl.
Scalef(-1.0f, 1.0f, 1.0f);
462 stringoutput_str(
text);
463 x_WriteText(x, y, width, height, output_str, align,
trunc, rotate_degrees,
true);
482vertex.
Set(
float(px),
float(py));
491 boolwrite_text)
const 498 boolreorient_text =
false;
501 boolbackwards = cos(
double(rads)) <
TModelUnit(0);
503reorient_text =
true;
518 stringrtext =
text;
522std::reverse(rtext.begin(), rtext.end());
524std::reverse(
str.begin(),
str.end());
557tx = x + (w - text_wid);
568ty = y + (h - text_ht);
599xi = floor(wx + 0.5);
601yi = floor(wy + 0.5);
611GLdouble xproj, yproj, zproj;
614&xproj, &yproj, &zproj);
624 doublexoff = xi-xproj;
625 doubleyoff = yi-yproj;
628gl.
Translated((GLdouble)rcenterx-xoff, (GLdouble)rcentery-yoff, 0.0);
629gl.
Rotated(rotate_degrees, 0.0, 0.0, 1.0);
630gl.
Translated((GLdouble)-rcenterx+xoff, (GLdouble)-rcentery+yoff, 0.0);
636gl.
Scalef(1.0f, -1.0f, 1.0f);
638gl.
Scalef(-1.0f, 1.0f, 1.0f);
704 const char*
text)
const 763ETruncate
trunc)
const 773 constvector<CRgbaColor*>*
colors,
783 for(
const char* p =
text; p && *p; ++p) {
789 stringtext_char(p, 1);
804 WriteText(pos_x-off_x, pos_y, text_char.c_str(), 0.0f);
816 return(
TModelUnit)(bounding.Upper().X() - bounding.Lower().X());
858 char str[] = {c,
'\0'};
867 doublemax_dig_w = 0;
869 for(
charc =
'0'; c <=
'9'; c++) {
871max_dig_w =
max(max_dig_w, char_w);
875 double mod=
abs(max_num);
877 intcommas_count = (digits_count - 1) / 3;
880 doublew = digits_count * max_dig_w + commas_count * comma_w;
895 static const char* sc_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890`~!@#$%^&*()_-+={}|[]\\:\";'<,>.?/";
897 static const char* sc_caps =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
906bounding =
m_Font->BBox(sc_caps);
916w =
m_Font->Advance(sc_chars);
923 for(
size_t i=0;
i<strlen(sc_chars); ++
i) {
924w =
m_Font->Advance(&sc_chars[
i], 1);
934 return(
TModelUnit)(bounding.Upper().X() - bounding.Lower().X());
992 for(
size_tj=0; j<
arr.size(); ++j) {
1032 return "Helvetica";
1035 return "Helvetica-Bold";
1038 return "Helvetica-Oblique";
1041 return "Helvetica-BoldOblique";
1044 return "Times-Roman";
1047 return "Times-Bold";
1050 return "Times-Italic";
1053 return "Times-BoldItalic";
1059 return "Courier-Bold";
1062 return "Courier-Oblique";
1065 return "Courier-BoldOblique";
1071 return "Courier-Bold";
1074 return "Courier-Oblique";
1077 return "Courier-BoldOblique";
1080 return "Times-Roman";
1083 return "Times-Bold";
1086 return "Times-Italic";
1089 return "Times-BoldItalic";
1095 return "Courier-Bold";
1098 return "Courier-Oblique";
1101 return "Courier-Bold";
1114 stringfont_string =
m_FontFile+
" "+ size_str;
1120 stringfont_size_str;
1172 string*
str)
const 1177 stringoriginal_text{
text};
1178 stringshort_text{
text};
1179 size_tactive_index = short_text.length();
1182 return(
int)short_text.length();
1184FTBBox text_bbox =
m_Font->BBox(short_text.c_str());
1187FTBBox ellipsis_bbox =
m_Font->BBox(
"...");
1188 TModelUnitellipsis_width =
TModelUnit(ellipsis_bbox.Upper().X() - ellipsis_bbox.Lower().X());
1190 if(w < ellipsis_width) {
1194 while(text_width > w) {
1195short_text = original_text.substr(0, --active_index);
1197short_text +=
"...";
1199text_bbox =
m_Font->BBox(short_text.c_str());
1200text_width =
TModelUnit(text_bbox.Upper().X() - text_bbox.Lower().X());
1203 if(
nullptr!=
str) {
1204 if(active_index != original_text.length())
1210 return(
int)active_index;
1218 string*
str)
const 1223 static const char* sc_ellipsis =
"...";
1224 static constFTBBox sc_ebbox =
m_Font->BBox(sc_ellipsis);
1226sc_ebbox.Lower().X());
1228 const char* ellip =
NULL;
1230 const char* end_pos =
text;
1239end_pos =
text+ pos;
1248ellip = sc_ellipsis;
1249FTBBox
b=
m_Font->BBox(end_pos, 1);
1250e_wid -=
TModelUnit(
b.Upper().X() -
b.Lower().X());
1251 if(end_pos >
text) {
1261 for( ; end_pos && *end_pos && w >= 0; ++end_pos) {
1264FTBBox
b=
m_Font->BBox(end_pos, 1);
1277 if(end_pos <
text) {
1282 str->assign(
text, end_pos);
1287 return(
int)(end_pos -
text);
1291 stringfont_file_name,
1292 unsigned intfont_size,
1293 booluse_bitmap_overrides)
const 1301(font_size == 6 || font_size == 8 || font_size == 10)) {
1303 if(font_size == 6) {
1306 else if(font_size == 8) {
1319 returnfont_file_name;
class CRgbaColor provides a simple abstraction for managing colors.
static const Colors colors
static vector< string > arr
static const char * str(char *buf, int n)
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
const T * GetData() const
virtual void Translated(GLdouble x, GLdouble y, GLdouble z)=0
void SetSnapToPixel(bool xpix, bool ypix)
If true (the default) text output position is rounded to nearest pixel coordinate,...
int gluProjectX(GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble modelMatrix[16], const GLdouble projMatrix[16], const GLint viewport[4], GLdouble *winx, GLdouble *winy, GLdouble *winz)
void Color4fv(const GLfloat *v)
virtual void Scalef(GLfloat x, GLfloat y, GLfloat z)=0
TFontRotateFlags m_Rotate
flags for center of rotation and how to handle direction and orientation
string ToString() const
saves and restores font face and size to/from a string
virtual void Translatef(GLfloat x, GLfloat y, GLfloat z)=0
virtual CMatrix4< float > GetProjectionMatrix() const =0
virtual void Enable(GLenum glstate)=0
virtual void UseProgram(GLuint program)=0
For shaders. Only works with OpenGL 2.0+.
virtual bool IsBitmapFont() const
Returns true if the currently loaded font is from a bitmap.
GLint m_Viewport[4]
Temporary variables initialized by the BeginText() function and used by the Draw() functions.
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)=0
Options to be used when GL_BLEND is enabled.
int x_Truncate(const char *text, TModelUnit w, ETruncate trunc, string *str=NULL) const
Truncate a string for display.
string x_GetFontFile(EFontFace face, string font_file_name, unsigned int font_size, bool use_bitmap_overrides=true) const
Return the font file for a font face - some fonts may use bitmap files for smaller sizes,...
virtual CMatrix4< float > GetModelViewMatrix() const =0
virtual void MatrixMode(GLenum mode)=0
static void GetAllFaces(vector< string > &faces)
GetAllFaces() and GetAllSizes() fills containers with strings repesenting all available enumerated (p...
bool m_SnapToPixelX
Normally, when text is written to the screen the position is synched to the nearest pixel.
IRender & GetGl()
convenience function for getting current render manager
void WriteText(TModelUnit x, TModelUnit y, const char *text, TModelUnit rotate_degrees=0.0) const
Write text at specified model coords.
CGlRect< TVPUnit > TVPRect
GLdouble m_ModelviewMatrix[16]
TModelUnit m_MetricFullCharHeight
void ArrayTextOut(TModelUnit x, TModelUnit y, TModelUnit dx, TModelUnit dy, const char *text, const vector< CRgbaColor * > *colors=NULL, TModelUnit scale_x=1.0f, TModelUnit scale_y=1.0f) const
prints array of characters in positions (x + i*dx, y + i*dy) where "i" is index of a character in the...
CMatrix4< double > GetTextXform(TModelUnit x, TModelUnit y, TModelUnit width, TModelUnit height, string &text, TAlign align=eAlign_Center, ETruncate trunc=eTruncate_Ellipsis, TModelUnit rotate_degrees=0.0f) const
Get the transformation that will be applied to the text to write it within the box (x,...
virtual TModelUnit GetFontDescender() const
virtual void LoadIdentity()=0
void x_ComputeMetrics()
Compute metrics for the font upon creation (for performance)
TModelUnit m_MetricMaxCharWidth
static string s_FontFileNames[]
This maps EFontFace enums to font file names for loading.
CMatrix4< double > x_WriteText(TModelUnit x, TModelUnit y, TModelUnit width, TModelUnit height, string &text, TAlign align, ETruncate trunc, TModelUnit rotate_degrees, bool write_text) const
Called by both writetext and gettexttransform to compute transformation matrix or write the text.
FTFont * m_Font
The current font for writing. These are owned by CFtglFontManager class.
static string GetFontFileForFace(EFontFace face)
Get font file for given face.
string m_FontFile
File from which current font was loaded.
virtual void PopMatrix()=0
static string PdfBaseFontName(EFontFace face, EFontFace &pdf_face)
Name of basefont for PDF purposes, or "" if not available.
static CFtglFontManager & Instance()
Get an instance of the manager so you can retrieve fonts.
GLint m_PrevShader
Switch back to previous shader after writing text.
static string FaceToString(EFontFace face)
funtions below provide conversion of font parameters to strings and back.
EFontFace m_FontFace
Current font face held by m_Font.
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
virtual void Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)=0
void BeginText() const
WriteText interface The WriteText functions produce the same results as TextOut but they are more eff...
TModelUnit m_MetricDescender
TModelUnit GetMaxWidth(int max_num) const
returns minimal space sufficient to render any number in [0, max_num].
EFontFace GetFontFace() const
virtual void TexEnvi(GLenum target, GLenum pname, GLint param)=0
static bool CheckGlError()
Check if there are any OpenGL errors.
virtual ERenderTarget GetApi()=0
virtual void PolygonMode(GLenum face, GLenum mode)=0
Set the polygon rasterization mode.
unsigned int m_FontSize
Size of current font.
GLdouble m_ProjectionMatrix[16]
void ProjectVertex(CVect2< float > &vertex) const
void EndText() const
Pops matrices and attributes after writing text.
virtual TModelUnit GetMetric(EMetric metric, const char *text=NULL, int len=-1) const
EFontFace
Set of pre-defined fonts for which we know we have valid font files.
CGlTextureFont()
default constructor.
virtual TModelUnit TextWidth(const char *text) const
Compute and return font metrics.
virtual TModelUnit TextHeight(void) const
static void GetAllSizes(vector< string > &sizes)
virtual void TextOut(const char *text) const
TextOut interface Write the specified text and set up state and transformation as needed.
void SetFontSize(unsigned int size)
Set/get font size in points.
static string s_FontNames[]
Maps EFontFace enums to a readable strings for selection lists.
int x_Truncate2(const char *text, TModelUnit w, ETruncate trunc, string *str=NULL) const
virtual void Disable(GLenum glstate)=0
glDisable()
virtual void Ortho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal)=0
TModelUnit m_MetricCharHeight
Pre-computed metrics (may be computed first time accessed)
FTFont * GetFont(const char *filename, unsigned int size, EFtglFontType ft=eTextureFont)
static EFontFace FaceFromString(const string &str)
Selects a font face given a string or eFontFace_LastFont on failure.
static int s_FontSizes[]
Font sizes used as a standard set for user selection - last element in array is set to 0 as a marker.
bool SetFont(string font_file_name, unsigned int font_size, bool use_bitmap_overrides=true)
Load font from file explicitly. Returns true on success, false otherwise.
unsigned int GetFontSize() const
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
TModelUnit m_MetricAvgCharWidth
bool FromString(const string &value)
virtual void PushMatrix()=0
string Truncate(const char *text, TModelUnit w, ETruncate trunc=eTruncate_Ellipsis) const
Truncate text to the secified width.
TModelUnit GetAdvance(char c) const
virtual void GetViewport(GLint *params)=0
@ fFontRotateMid
Rotate around mid-left of unrotated text box.
@ fReorientText
Ensure rotated text reads L to R and is rightside-up.
@ fFontRotateCap
Rotate around upper-left corner of unrotated text box.
@ eFontFace_Helvetica_Bold
@ eFontFace_LastBitmapFont
@ eFontFace_TimesRoman_Italic
@ eFontFace_Lucida_BoldItalic
@ eFontFace_BPMono_Italic
@ eFontFace_BPMono_BoldStencil
@ eFontFace_Courier_Italic
@ eFontFace_Helvetica_BoldItalic
@ eFontFace_Helvetica_Italic
@ eFontFace_Fixed_BoldItalic
@ eFontFace_TimesRoman_BoldItalic
@ eFontFace_TimesRoman_Bold
@ eFontFace_Courier_BoldItalic
@ eFontFace_Lucida_Italic
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static TNumeric StringToNumeric(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to a numeric value.
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
@ eNocase
Case insensitive compare.
unsigned int
A callback function used to compare two keys in a database.
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4