Go to the documentation of this file.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 #ifndef WPS_WIN
00036 # define WPS_WIN
00037
00038 # include <assert.h>
00039 # include <string>
00040
00041 # include "libwps_internal.h"
00042
00044 namespace libwps_tools_win
00045 {
00047 class Font
00048 {
00049 public:
00051 enum Type { DOS_850,
00052 WIN3_ARABIC, WIN3_BALTIC, WIN3_CEUROPE, WIN3_CYRILLIC,
00053 WIN3_GREEK, WIN3_HEBREW, WIN3_TURKISH,
00054 WIN3_VIETNAMESE, WIN3_WEUROPE
00055 };
00056
00058 static unsigned long unicode(unsigned char c, Type type)
00059 {
00060 switch(type)
00061 {
00062 case DOS_850:
00063 return unicodeFromCP850(c);
00064 case WIN3_ARABIC:
00065 return unicodeFromCP1256(c);
00066 case WIN3_BALTIC:
00067 return unicodeFromCP1257(c);
00068 case WIN3_CEUROPE:
00069 return unicodeFromCP1250(c);
00070 case WIN3_CYRILLIC:
00071 return unicodeFromCP1251(c);
00072 case WIN3_GREEK:
00073 return unicodeFromCP1253(c);
00074 case WIN3_HEBREW:
00075 return unicodeFromCP1255(c);
00076 case WIN3_TURKISH:
00077 return unicodeFromCP1254(c);
00078 case WIN3_VIETNAMESE:
00079 return unicodeFromCP1258(c);
00080 case WIN3_WEUROPE:
00081 return unicodeFromCP1252(c);
00082 default:
00083 assert(0);
00084 return c;
00085 }
00086 }
00087
00093 static Type getWin3Type(std::string &name);
00094
00095 protected:
00096
00097
00098
00099
00101 static unsigned long unicodeFromCP850(unsigned char c);
00102
00104 static unsigned long unicodeFromCP1250(unsigned char c);
00106 static unsigned long unicodeFromCP1251(unsigned char c);
00108 static unsigned long unicodeFromCP1252(unsigned char c);
00110 static unsigned long unicodeFromCP1253(unsigned char c);
00112 static unsigned long unicodeFromCP1254(unsigned char c);
00114 static unsigned long unicodeFromCP1255(unsigned char c);
00116 static unsigned long unicodeFromCP1256(unsigned char c);
00118 static unsigned long unicodeFromCP1257(unsigned char c);
00120 static unsigned long unicodeFromCP1258(unsigned char c);
00121 };
00122
00123
00125 namespace Language
00126 {
00128 std::string name(long id);
00130 std::string localeName(long id);
00132 long getDefault();
00133 }
00134
00135 }
00136
00137
00138 #endif
00139