Skip to content
Snippets Groups Projects
Commit 065f6bcc authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

TextAttributes

parent f0063eb1
No related branches found
No related tags found
No related merge requests found
...@@ -214,6 +214,7 @@ SyncModel return tSyncModel; ...@@ -214,6 +214,7 @@ SyncModel return tSyncModel;
T2 return tText2D; T2 return tText2D;
T3 return tText3D; T3 return tText3D;
TextAttributes return tTextAttributes;
TIME return tTime; TIME return tTime;
Transfinite return tTransfinite; Transfinite return tTransfinite;
Transf[qQ]uad[tT]ri return tTransfQuadTri; Transf[qQ]uad[tT]ri return tTransfQuadTri;
......
This diff is collapsed.
...@@ -78,106 +78,107 @@ ...@@ -78,106 +78,107 @@
tStrPrefix = 295, tStrPrefix = 295,
tStrRelative = 296, tStrRelative = 296,
tStrFind = 297, tStrFind = 297,
tBoundingBox = 298, tTextAttributes = 298,
tDraw = 299, tBoundingBox = 299,
tToday = 300, tDraw = 300,
tSyncModel = 301, tToday = 301,
tCreateTopology = 302, tSyncModel = 302,
tCreateTopologyNoHoles = 303, tCreateTopology = 303,
tDistanceFunction = 304, tCreateTopologyNoHoles = 304,
tDefineConstant = 305, tDistanceFunction = 305,
tPoint = 306, tDefineConstant = 306,
tCircle = 307, tPoint = 307,
tEllipse = 308, tCircle = 308,
tLine = 309, tEllipse = 309,
tSphere = 310, tLine = 310,
tPolarSphere = 311, tSphere = 311,
tSurface = 312, tPolarSphere = 312,
tSpline = 313, tSurface = 313,
tVolume = 314, tSpline = 314,
tCharacteristic = 315, tVolume = 315,
tLength = 316, tCharacteristic = 316,
tParametric = 317, tLength = 317,
tElliptic = 318, tParametric = 318,
tRefineMesh = 319, tElliptic = 319,
tPlane = 320, tRefineMesh = 320,
tRuled = 321, tPlane = 321,
tTransfinite = 322, tRuled = 322,
tComplex = 323, tTransfinite = 323,
tPhysical = 324, tComplex = 324,
tCompound = 325, tPhysical = 325,
tPeriodic = 326, tCompound = 326,
tUsing = 327, tPeriodic = 327,
tPlugin = 328, tUsing = 328,
tDegenerated = 329, tPlugin = 329,
tRotate = 330, tDegenerated = 330,
tTranslate = 331, tRotate = 331,
tSymmetry = 332, tTranslate = 332,
tDilate = 333, tSymmetry = 333,
tExtrude = 334, tDilate = 334,
tLevelset = 335, tExtrude = 335,
tRecombine = 336, tLevelset = 336,
tSmoother = 337, tRecombine = 337,
tSplit = 338, tSmoother = 338,
tDelete = 339, tSplit = 339,
tCoherence = 340, tDelete = 340,
tIntersect = 341, tCoherence = 341,
tMeshAlgorithm = 342, tIntersect = 342,
tLayers = 343, tMeshAlgorithm = 343,
tHole = 344, tLayers = 344,
tAlias = 345, tHole = 345,
tAliasWithOptions = 346, tAlias = 346,
tQuadTriDbl = 347, tAliasWithOptions = 347,
tQuadTriSngl = 348, tQuadTriDbl = 348,
tRecombLaterals = 349, tQuadTriSngl = 349,
tTransfQuadTri = 350, tRecombLaterals = 350,
tText2D = 351, tTransfQuadTri = 351,
tText3D = 352, tText2D = 352,
tInterpolationScheme = 353, tText3D = 353,
tTime = 354, tInterpolationScheme = 354,
tCombine = 355, tTime = 355,
tBSpline = 356, tCombine = 356,
tBezier = 357, tBSpline = 357,
tNurbs = 358, tBezier = 358,
tNurbsOrder = 359, tNurbs = 359,
tNurbsKnots = 360, tNurbsOrder = 360,
tColor = 361, tNurbsKnots = 361,
tColorTable = 362, tColor = 362,
tFor = 363, tColorTable = 363,
tIn = 364, tFor = 364,
tEndFor = 365, tIn = 365,
tIf = 366, tEndFor = 366,
tEndIf = 367, tIf = 367,
tExit = 368, tEndIf = 368,
tAbort = 369, tExit = 369,
tField = 370, tAbort = 370,
tReturn = 371, tField = 371,
tCall = 372, tReturn = 372,
tFunction = 373, tCall = 373,
tShow = 374, tFunction = 374,
tHide = 375, tShow = 375,
tGetValue = 376, tHide = 376,
tGetEnv = 377, tGetValue = 377,
tGetString = 378, tGetEnv = 378,
tHomology = 379, tGetString = 379,
tCohomology = 380, tHomology = 380,
tBetti = 381, tCohomology = 381,
tGMSH_MAJOR_VERSION = 382, tBetti = 382,
tGMSH_MINOR_VERSION = 383, tGMSH_MAJOR_VERSION = 383,
tGMSH_PATCH_VERSION = 384, tGMSH_MINOR_VERSION = 384,
tAFFECTDIVIDE = 385, tGMSH_PATCH_VERSION = 385,
tAFFECTTIMES = 386, tAFFECTDIVIDE = 386,
tAFFECTMINUS = 387, tAFFECTTIMES = 387,
tAFFECTPLUS = 388, tAFFECTMINUS = 388,
tOR = 389, tAFFECTPLUS = 389,
tAND = 390, tOR = 390,
tNOTEQUAL = 391, tAND = 391,
tEQUAL = 392, tNOTEQUAL = 392,
tGREATEROREQUAL = 393, tEQUAL = 393,
tLESSOREQUAL = 394, tGREATEROREQUAL = 394,
UNARYPREC = 395, tLESSOREQUAL = 395,
tMINUSMINUS = 396, UNARYPREC = 396,
tPLUSPLUS = 397 tMINUSMINUS = 397,
tPLUSPLUS = 398
}; };
#endif #endif
...@@ -201,7 +202,7 @@ typedef union YYSTYPE ...@@ -201,7 +202,7 @@ typedef union YYSTYPE
/* Line 1685 of yacc.c */ /* Line 1685 of yacc.c */
#line 205 "Gmsh.tab.hpp" #line 206 "Gmsh.tab.hpp"
} YYSTYPE; } YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
......
...@@ -107,6 +107,7 @@ struct doubleXstring{ ...@@ -107,6 +107,7 @@ struct doubleXstring{
%token tAtan tAtan2 tSinh tCosh tTanh tFabs tFloor tCeil %token tAtan tAtan2 tSinh tCosh tTanh tFabs tFloor tCeil
%token tFmod tModulo tHypot tList %token tFmod tModulo tHypot tList
%token tPrintf tError tSprintf tStrCat tStrPrefix tStrRelative tStrFind %token tPrintf tError tSprintf tStrCat tStrPrefix tStrRelative tStrFind
%token tTextAttributes
%token tBoundingBox tDraw tToday tSyncModel tCreateTopology tCreateTopologyNoHoles %token tBoundingBox tDraw tToday tSyncModel tCreateTopology tCreateTopologyNoHoles
%token tDistanceFunction tDefineConstant %token tDistanceFunction tDefineConstant
%token tPoint tCircle tEllipse tLine tSphere tPolarSphere tSurface tSpline tVolume %token tPoint tCircle tEllipse tLine tSphere tPolarSphere tSurface tSpline tVolume
...@@ -4242,6 +4243,30 @@ FExpr_Single : ...@@ -4242,6 +4243,30 @@ FExpr_Single :
$$ = 0.; $$ = 0.;
Free($3); Free($5); Free($3); Free($5);
} }
| tTextAttributes '(' RecursiveListOfStringExprVar ')'
{
int align = 0, font = 0, fontsize = CTX::instance()->glFontSize;
if(List_Nbr($3) % 2){
yyerror("Number of text attributes should be even");
}
else{
for(int i = 0 ; i < List_Nbr($3); i += 2){
char *s1, *s2; List_Read($3, i, &s1); List_Read($3, i + 1, &s2);
std::string key(s1), val(s2);
Free(s1); Free(s2);
#if defined(HAVE_OPENGL)
if(key == "Font")
font = drawContext::global()->getFontIndex(val.c_str());
else if(key == "FontSize")
fontsize = atoi(val.c_str());
else if(key == "Align")
align = drawContext::global()->getFontAlign(val.c_str());
#endif
}
}
List_Delete($3);
$$ = (double)((align<<16)|(font<<8)|(fontsize));
}
; ;
VExpr : VExpr :
......
This diff is collapsed.
...@@ -979,6 +979,7 @@ parsing of the script file: ...@@ -979,6 +979,7 @@ parsing of the script file:
@var{built-in-function} | @var{built-in-function} |
@var{real-option} | @var{real-option} |
StrFind(@var{char-expression}, @var{char-expression}) | StrFind(@var{char-expression}, @var{char-expression}) |
TextAttributes(@var{char-expression}<,@var{char-expression}@dots>)|
GetValue("@var{string}", @var{expression}) GetValue("@var{string}", @var{expression})
@end example @end example
...@@ -992,7 +993,8 @@ in @ref{Operators}. For the definition of @w{@var{built-in-function}s}, ...@@ -992,7 +993,8 @@ in @ref{Operators}. For the definition of @w{@var{built-in-function}s},
see @ref{Built-in functions}. The various @w{@var{real-option}s} are see @ref{Built-in functions}. The various @w{@var{real-option}s} are
listed in @ref{Options}. @code{StrFind} searches the first listed in @ref{Options}. @code{StrFind} searches the first
@var{char-expression} for any occurrence of the second @var{char-expression} for any occurrence of the second
@var{char-expression}. @var{char-expression}. @code{TextAttributes} creates attributes for text
strings.
The last case in the definition allows to ask the user for a value The last case in the definition allows to ask the user for a value
interactively. For example, inserting @code{GetValue("Value of parameter interactively. For example, inserting @code{GetValue("Value of parameter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment