00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef _SO_TEXT_3_
00051 #define _SO_TEXT_3_
00052
00053 #include <Inventor/SbBox.h>
00054 #include <Inventor/fields/SoMFString.h>
00055 #include <Inventor/fields/SoSFBitMask.h>
00056 #include <Inventor/fields/SoSFFloat.h>
00057 #include <Inventor/fields/SoMFVec3f.h>
00058 #include <Inventor/nodes/SoShape.h>
00059 #include <Inventor/STL/map>
00060
00061 class SoFontServer;
00062 class TextBBoxCache;
00063 class SbBox3f;
00064 class SoAnnoText3;
00065 class SoAsciiText;
00066 class SoVRMLText;
00067 struct Pid_primitive_data;
00068
00208 class SoText3 : public SoShape {
00209
00210 SO_NODE_HEADER(SoText3);
00211
00212 public:
00214 enum Justification {
00218 LEFT = 0x01,
00222 CENTER = 0x03,
00226 RIGHT = 0x02,
00230 INHERITED = 0x04
00231 };
00232
00234 enum Part {
00238 FRONT = 0x01,
00242 SIDES = 0x02,
00246 BACK = 0x04,
00250 ALL = 0x07
00251 };
00252
00253
00258 SoMFString string;
00259
00266 SoSFFloat spacing;
00267
00273 SoSFBitMask parts;
00274
00283 SoSFEnum justification;
00284
00288 SoText3();
00289
00290 private:
00291
00304 SbBox3f getCharacterBounds(SoState *state, int stringIndex, int charIndex);
00305
00306 virtual void GLRender(SoGLRenderAction *action);
00307 virtual void notify(SoNotList *list);
00308 virtual void rayPick(SoRayPickAction *action);
00309 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00310
00314 virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er);
00315
00316 private:
00317 static void initClass();
00318 static void exitClass();
00319
00320 void addFontCache(void *fontCache);
00321 void removeFontCache(void *fontCache);
00322 int getNumFontCache();
00323 void* getFontCache(int i);
00324
00325 void setAsciiText(SoAsciiText*);
00326 SoAsciiText* getAsciiText();
00327 void setVRMLText(SoVRMLText*);
00328 SoVRMLText* getVRMLText();
00329
00330 private:
00331
00335 virtual ~SoText3();
00336
00342 virtual SbBool shouldGLRender(SoGLRenderAction *action, SbBool isPointsOrLines = FALSE);
00343
00347 virtual void generatePrimitives(SoAction *);
00348
00349 friend class SoAnnoText3;
00350 friend class SoAsciiText;
00351 friend class SoVRMLText;
00352
00353 private:
00354
00355 SoFontServer* m_fontServer;
00356 SbPList* m_fontBaseList;
00357
00358
00359 SoDetail* createTriangleDetail(SoRayPickAction *, const SoPrimitiveVertex *, const SoPrimitiveVertex *, const SoPrimitiveVertex *, SoPickedPoint *);
00360
00361
00362
00363 SbBool m_isMultiByteStroke;
00364 float kanjiHeight;
00365 Pid_primitive_data *m_primitive_data;
00366 int m_num_prim;
00367
00368 SbVec2f getMultiByteStrokeStringOffset(SoState* state, int line);
00369 void renderMultiByteStroke(SoGLRenderAction *action, int line);
00370 void renderMultiByteStrokeFont(SoGLRenderAction *action);
00371 void getMultiByteStrokeBBox(SoAction *action, SbBox2f &result);
00372 void getMultiByteStrokeFont(int kfont);
00373 SbBool setupFontMultiByteStroke(SoState *state, SbBool forRender);
00374 void kanjiSetupCharacters(int line, int *numChar);
00375 SbBool kanjiCheck();
00376 SbBool areISOLatinCharsUsed() const;
00377 void freeMultiByteStroke();
00378 void generateMultiByteStrokePrimitives(SoAction *);
00379
00385 void getMultiByteStrokeVertices(SoAction *action, int line,
00386 std::vector<SbVec2f>& vertices,
00387 std::vector<unsigned int>& verticesPerLine);
00388
00390 void renderMultiByteStroke(SoGLRenderAction *action,
00391 std::vector<SbVec2f>& vertices,
00392 std::vector<unsigned int>& verticesPerLine);
00393
00394 SoAsciiText* m_asciiText;
00395 SoVRMLText* m_VRMLText;
00396
00397 static bool s_isolatin_stroke_font;
00398 };
00399
00400 #endif // _SO_TEXT_3_
00401
00402
00403
00404
00405