25#include <tqstringlist.h>
26#include <tqtextstream.h>
27#include <tqfontmetrics.h>
33#include <kstandarddirs.h>
35#include "symboltable.h"
36#include "contextstyle.h"
37#include "unicodetable.cpp"
40KFORMULA_NAMESPACE_BEGIN
42#include "symbolfontmapping.cpp"
44SymbolFontHelper::SymbolFontHelper()
45 : greek( "abgdezhqiklmnxpvrstufjcywGDTQLXPSUFYVW")
47 for ( uint i = 0; symbolMap[ i ].unicode != 0; i++ ) {
48 compatibility[ symbolMap[ i ].pos ] = symbolMap[ i ].unicode;
54 if ( compatibility.contains( pos ) ) {
55 return compatibility[ pos.latin1() ];
61SymbolTable::SymbolTable()
69 for ( int i=0; operatorTable[i].unicode != 0; ++i ) {
70 names[TQChar( operatorTable[i]. unicode )] = get_name( operatorTable[i] );
71 entries[get_name( operatorTable[i] )] = TQChar( operatorTable[i]. unicode );
73 for ( int i=0; arrowTable[i].unicode != 0; ++i ) {
74 names[TQChar( arrowTable[i]. unicode )] = get_name( arrowTable[i] );
75 entries[get_name( arrowTable[i] )] = TQChar( arrowTable[i]. unicode );
77 for ( int i=0; greekTable[i].unicode != 0; ++i ) {
78 names[TQChar( greekTable[i]. unicode )] = get_name( greekTable[i] );
79 entries[get_name( greekTable[i] )] = TQChar( greekTable[i]. unicode );
83bool SymbolTable::contains(TQString name) const
85 return entries.find( name ) != entries.end();
90 return entries[ name ];
94TQString SymbolTable::name( TQChar symbol ) const
99TQFont SymbolTable::font( TQChar symbol, const TQFont& f ) const {
100 TQFontMetrics fm( f );
101 if ( fm.inFont( symbol ) ) {
104 return TQFont( "Arev Sans");
107CharClass SymbolTable::charClass( TQChar symbol ) const
117 return symbolFontHelper.unicodeFromSymbolFont( pos );
123 return symbolFontHelper.greekLetters();
131 for ( int i=0; operatorTable[i].unicode != 0; ++i ) {
132 list.append( get_name( operatorTable[i] ));
134 for ( int i=0; arrowTable[i].unicode != 0; ++i ) {
135 list.append( get_name( arrowTable[i] ));
137 for ( int i=0; greekTable[i].unicode != 0; ++i ) {
138 list.append( get_name( greekTable[i] ) );
144TQString SymbolTable::get_name( struct UnicodeNameTable entry ) const
146 if ( !*entry.name ) {
147 return "U" + TQString( "%1" ).arg( entry.unicode, 4, 16 ).upper();
152KFORMULA_NAMESPACE_END
TQChar unicodeFromSymbolFont(TQChar pos) const
void init(const TQFont &font) lazy init support.
TQChar unicodeFromSymbolFont(TQChar pos) const
TQStringList allNames() const
TQString greekLetters() const
TQChar unicode(TQString name) const
|