1f1569dbbSStefano Ceccherini #ifndef __WIDTHBUFFER_H 2f1569dbbSStefano Ceccherini #define __WIDTHBUFFER_H 3f1569dbbSStefano Ceccherini 4f1569dbbSStefano Ceccherini #include "TextViewSupportBuffer.h" 5f1569dbbSStefano Ceccherini 6f1569dbbSStefano Ceccherini struct _width_table_ { 7f1569dbbSStefano Ceccherini #if B_BEOS_VERSION_DANO 8f1569dbbSStefano Ceccherini BFont font; // corresponding font 9f1569dbbSStefano Ceccherini #else 10f1569dbbSStefano Ceccherini int32 fontCode; // font code 11f1569dbbSStefano Ceccherini float fontSize; // font size 12f1569dbbSStefano Ceccherini #endif 13f1569dbbSStefano Ceccherini int32 hashCount; // number of hashed items 14f1569dbbSStefano Ceccherini int32 tableCount; // size of table 15f1569dbbSStefano Ceccherini void *widths; // width table 16f1569dbbSStefano Ceccherini }; 17f1569dbbSStefano Ceccherini 18*e0649957SStefano Ceccherini class _BTextGapBuffer_; 19f1569dbbSStefano Ceccherini class _BWidthBuffer_ : public _BTextViewSupportBuffer_<_width_table_> { 20f1569dbbSStefano Ceccherini public: 21f1569dbbSStefano Ceccherini _BWidthBuffer_(); 22f1569dbbSStefano Ceccherini virtual ~_BWidthBuffer_(); 23f1569dbbSStefano Ceccherini 24f1569dbbSStefano Ceccherini float StringWidth(const char *inText, int32 fromOffset, int32 length, 25f1569dbbSStefano Ceccherini const BFont *inStyle); 26f1569dbbSStefano Ceccherini float StringWidth(_BTextGapBuffer_ &, int32 fromOffset, int32 length, 27f1569dbbSStefano Ceccherini const BFont *inStyle); 28f1569dbbSStefano Ceccherini 29f1569dbbSStefano Ceccherini private: 30f1569dbbSStefano Ceccherini bool FindTable(const BFont *font, int32 *outIndex); 31f1569dbbSStefano Ceccherini int32 InsertTable(const BFont *font); 32f1569dbbSStefano Ceccherini 33f1569dbbSStefano Ceccherini bool GetEscapement(uint32, int32, float *); 34f1569dbbSStefano Ceccherini float HashEscapements(const char *, int32, int32, int32, const BFont *); 35f1569dbbSStefano Ceccherini 36f1569dbbSStefano Ceccherini static uint32 Hash(uint32); 37f1569dbbSStefano Ceccherini }; 38f1569dbbSStefano Ceccherini 39f1569dbbSStefano Ceccherini #endif // __WIDTHBUFFER_H 40