📄 fontinfo.cpp
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: fontinfo.cpp,v 1.1.2.1 2004/07/09 01:50:20 hubbe Exp $ * * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. * * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks. You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL. Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. * * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. * * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. * * Technology Compatibility Kit Test Suite(s) Location: * http://www.helixcommunity.org/content/tck * * Contributor(s): * * ***** END LICENSE BLOCK ***** *////////////////////////////////////////////////////////////////////////////////// fontinfo.cpp//// INT16 GetCharacterWidth(UINT16 ch, ULONG32 ulFontFaceIndex,// ULONG32 ulFontPtSize, BOOL isBold, BOOL isItalicized,// ULONG32 ulFontCharsetIndex)// This function takes a char (which can be a 2-byte char, thus the val// passed in is a UINT16) and calculates its "width" (x-extent) in pixels// based on its font face (e.g., "courier"), its point size, whether or not// it is bold and/or is italicized. The parameter ulFontCharsetIndex tells// the function whether or not the character is single byte, double byte,// or Unicode.////#include "hxtypes.h"#include "rt_types.h"#include "fontdefs.h"#include "fontinfo.h"#include "string.h" //for strcpy()#include "hxassert.h"#include "textprsr.h" /*for ..._CONTENT_VERSION_... defines */#include "hxheap.h"#ifdef _DEBUG#undef HX_THIS_FILE static char HX_THIS_FILE[] = __FILE__;#endif//use 256 here to allow upper sbcs chars#define SBCS_NUM_CHARS 128#define SBCS_FIRST_NON_CONTROL_CHAR 32#define UNKNOWN_TIMES_8PT_CHAR_WIDTH 5//== ceiling(avg char width * 1.25).#define UNKNOWN_TIMES_10PT_CHAR_WIDTH 6//== ceiling(avg char width * 1.25).#define UNKNOWN_TIMES_12PT_CHAR_WIDTH 7//== ceiling(avg char width * 1.25).#define UNKNOWN_TIMES_14PT_CHAR_WIDTH 8//== ceiling(avg char width * 1.25).#define UNKNOWN_TIMES_16PT_CHAR_WIDTH 9//== ceiling(avg char width * 1.25).#define UNKNOWN_TIMES_20PT_CHAR_WIDTH 11//== ceiling(avg char width* 1.25).#define UNKNOWN_TIMES_24PT_CHAR_WIDTH 14//== ceiling(avg char width* 1.25).#define UNKNOWN_TIMES_36PT_CHAR_WIDTH 20//== ceiling(avg char width* 1.25).#define UNKNOWN_TIMES_48PT_CHAR_WIDTH 27//== ceiling(avg char width* 1.25).#define UNKNWNWDTH16 8#define UNKNWNWDTH100 50const UINT8 timesFontWidths16PointRegular[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 4, 5, 5, 7, 7,12,11, 4, 5, 5, 7, 8, 4, 5, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 4, 8, 8, 8, 6, 13, 9, 8, 9,10, 8, 8,10, 9, 5, 6, 9, 8,12,10,10, 8,10, 9, 8, 9, 9, 9,13,10, 9, 8, 5, 4, 5, 6, 7, 4, 6, 7, 7, 7, 6, 5, 7, 7, 3, 3, 7, 3,11, 7, 7, 7, 7, 5, 6, 4, 7, 7,11, 7, 7, 6, 7, 3, 7, 8, 4 };const UINT8 timesFontWidths16PointBold[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 3, 4, 7, 7, 7,15,11, 4, 4, 4, 7, 7, 3, 4, 3, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 7, 7, 7, 7, 12, 9, 9, 9, 9, 7, 7, 9, 9, 4, 7, 9, 8,11, 9,10, 8,10, 9, 8, 8, 8, 9,13, 9, 8, 8, 4, 4, 4, 8, 7, 4, 6, 6, 6, 6, 6, 4, 7, 7, 4, 4, 8, 4,10, 7, 6, 6, 6, 6, 6, 4, 7, 5, 8, 6, 6, 6, 5, 3, 5, 7, 3 };const UINT8 timesFontWidths16PointItalics[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 4, 4, 7, 7, 7,11,12, 4, 5, 5, 7, 9, 4, 5, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 9, 9, 9, 7, 13, 9, 9, 9,10, 9, 9,10,10, 5, 6, 9, 8,12, 9,10, 9,10, 9, 7, 8,10, 9,11, 9, 8, 8, 6, 4, 6, 6, 7, 4, 7, 7, 6, 7, 6, 5, 7, 7, 4, 4, 7, 4,10, 7, 7, 7, 7, 5, 5, 4, 7, 7, 9, 6, 6, 5, 6, 4, 6, 8, 4 };const UINT8 timesFontWidths16PointBoldItalics[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 3, 5, 7, 6, 7,11,10, 4, 4, 4, 7, 7, 3, 4, 3, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 7, 7, 7, 7, 11, 9, 9, 9, 9, 9, 9, 9,10, 5, 6, 9, 8,12, 9, 9, 8, 9, 9, 7, 8, 9, 9,12, 9, 7, 8, 4, 4, 4, 7, 7, 4, 7, 7, 6, 7, 6, 4, 7, 7, 4, 4, 7, 4,10, 7, 7, 7, 7, 5, 5, 4, 7, 6, 9, 7, 6, 5, 5, 3, 5, 8, 3 };const UINT8 timesFontWidths20PointRegular[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 5, 6, 7, 9, 9,15,14, 5, 6, 6, 9,10, 5, 6, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 5,10,10,10, 8, 16,12,12,12,13,11,10,13,13, 6, 7,13,11,16,13,13, 11,13,12,10,12,13,12,17,13,13,11, 6, 5, 6, 8, 9, 6, 8, 9, 8, 9, 8, 6, 8, 9, 4, 5, 9, 4,14, 9, 9, 9, 9, 6, 7, 5, 9, 9,13, 8, 9, 8, 9, 3, 9,10, 5 };const UINT8 timesFontWidths20PointBold[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 5, 5,10, 9, 9,17,15, 5, 6, 6, 9,10, 5, 6, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5,10,10,10, 9, 17,13,12,13,13,11,10,14,14, 7, 9,14,12,17,13,14, 11,14,13,10,11,13,13,17,12,12,11, 6, 5, 6,10, 9, 6, 9,10, 8,10, 8, 6, 9,10, 5, 6,10, 5,15,10,10, 10,10, 7, 7, 6,10, 9,12, 9, 9, 8, 7, 3, 7, 9, 5 };const UINT8 timesFontWidths24PointRegular[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 5, 6, 8,11,11,18,16, 6, 7, 7,10,12, 5, 7, 5, 6, 11,11,11,11,11,11,11,11,11,11, 6, 5,12,12,12,10, 19,14,14,14,15,13,12,15,15, 6, 8,15,12,18,15,15, 12,15,14,11,12,15,15,19,14,15,12, 7, 6, 7,10,11, 6, 9,10, 9,10, 9, 7,10,10, 6, 6,10, 6,16,10,11, 10,10, 7, 8, 6,11,10,15,10, 9, 9,10, 3,10,11, 5 };const UINT8 timesFontWidths24PointBold[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 5, 7,12,11,11,20,18, 7, 7, 7,11,12, 5, 7, 5, 6, 11,11,11,11,11,11,11,11,11,11, 7, 7,12,12,12,11, 20,15,15,15,15,14,14,16,16, 7,11,17,14,19,15,16, 14,16,15,12,13,15,15,20,15,15,13, 7, 6, 7,12,11, 7,11,11,10,11,10, 7,11,11, 5, 6,11, 5,17,11,11, 11,11, 8, 8, 7,11,11,15,10,10, 9, 8, 5, 8,11, 5 };const UINT8 timesFontWidths100PointRegular[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 22,29,35,42,42,73,68,22,29,29,42,50,22,28,22,25, 42,42,42,42,42,42,42,42,42,42,24,24,50,50,50,40, 81,62,59,59,64,54,47,64,64,28,35,62,52,77,65,64, 53,64,59,49,59,64,62,83,64,64,53,29,24,29,40,46, 28,39,44,39,44,39,29,42,44,23,24,44,23,67,44,44, 44,44,30,34,24,44,43,63,42,42,39,42,16,42,48,22 };const UINT8 arialFontWidths16PointRegular[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 4, 3, 5, 7, 7,12, 9, 4, 4, 4, 5, 8, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 8, 8, 7, 13, 9, 9, 9, 9, 9, 8,10, 9, 3, 6, 9, 7,11, 9,10, 9,10, 9, 9, 7, 9, 9,13, 7, 9, 7, 4, 4, 4, 5, 7, 4, 7, 7, 7, 7, 7, 3, 7, 7, 3, 3, 7, 3,11, 7, 7, 7, 7, 4, 7, 4, 7, 5, 9, 7, 7, 7, 4, 3, 4, 8, 4 };const UINT8 arialFontWidths16PointBold[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 4, 4, 6, 7, 7,10, 9, 4, 4, 4, 5, 8, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 8, 8, 8, 13, 9, 9, 9, 9, 8, 8,10, 9, 4, 7, 9, 8,11, 9,10, 9,10, 9, 9, 8, 9, 9,13, 9, 8, 7, 4, 4, 4, 8, 7, 4, 8, 8, 7, 8, 8, 4, 8, 8, 4, 4, 7, 4,12, 8, 8, 8, 8, 5, 6, 4, 8, 7,11, 8, 7, 7, 5, 3, 5, 8, 3 };const UINT8 arialFontWidths16PointItalics[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 4, 4, 5, 7, 7,12, 9, 4, 4, 4, 5, 8, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 8, 8, 7, 13, 9, 9, 9, 9, 9, 8,10, 9, 4, 7, 9, 7,10, 9,10, 9,10, 9, 9, 8, 9, 9,13, 9, 9, 8, 4, 4, 4, 6, 7, 4, 7, 8, 7, 7, 7, 4, 7, 7, 3, 3, 8, 3,11, 7, 7, 7, 7, 4, 7, 4, 7, 6, 8, 6, 6, 7, 4, 3, 4, 8, 4 };const UINT8 arialFontWidths16PointBoldItalics[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 4, 4, 6, 7, 7,11, 9, 4, 4, 4, 5, 8, 4, 4, 4, 4, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4, 8, 8, 8, 8, 12,10, 9, 9, 9, 9, 8,10, 9, 3, 7, 9, 8,12, 9,10, 8,10, 9, 9, 8, 9, 9,13, 9, 9, 9, 4, 4, 4, 8, 7, 4, 7, 8, 7, 8, 7, 4, 8, 8, 4, 4, 8, 4,12, 8, 8, 8, 8, 5, 6, 4, 8, 7,10, 7, 7, 7, 5, 3, 5, 8, 4 };const UINT8 arialFontWidths20PointRegular[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 5, 5, 6, 9, 9,15,11, 6, 6, 6, 7,10, 5, 6, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5,10,10,10, 9, 17,11,11,12,12,11,10,12,11, 5, 9,11, 9,13,11,12, 11,12,11,11, 9,11,11,17,11,11, 9, 5, 5, 5, 7, 9, 6, 9, 9, 9, 9, 9, 5, 9, 9, 4, 3, 8, 3,13, 9, 9, 9, 9, 6, 8, 4, 9, 7,11, 7, 9, 8, 6, 5, 6,10, 5 };const UINT8 arialFontWidths20PointBold[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 5, 6, 8, 9, 9,16,12, 6, 6, 6, 7,10, 5, 6, 5, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6,10,10,10,10, 17,11,12,12,12,11,10,13,12, 4, 9,12,10,13,12,13, 11,13,12,11,10,12,11,17,11,10, 9, 6, 5, 6,10, 9, 6, 9,10, 9,10, 9, 5,10,10, 4, 4, 9, 4,14,10,10, 10,10, 7, 9, 6,10, 9,13, 9, 9, 9, 7, 4, 7,10, 5 };const UINT8 arialFontWidths24PointRegular[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 6, 6, 7,12,12,19,14, 7, 7, 7, 8,12, 6, 7, 6, 6, 12,12,12,12,12,12,12,12,12,12, 6, 6,12,12,12,12, 21,13,14,15,15,14,13,16,14, 6,11,14,12,17,14,16, 14,16,15,14,12,14,13,21,14,14,13, 6, 6, 6, 8,12, 7,12,11,11,11,12, 6,11,11, 5, 4,10, 4,16,11,12, 11,11, 7,11, 6,11,11,15,10,11, 9, 7, 6, 7,12, 6 };const UINT8 arialFontWidths24PointBold[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 6, 7, 9,11,11,17,14, 7, 7, 7, 8,12, 6, 7, 6, 6, 11,11,11,11,11,11,11,11,11,11, 7, 7,12,12,12,12, 20,13,14,14,14,13,12,16,14, 5,11,14,12,17,14,16, 13,16,14,13,13,14,13,19,13,13,11, 7, 6, 7,12,11, 7,11,12,11,12,11, 7,12,12, 5, 5,11, 5,17,12,12, 12,12, 8,11, 7,12,11,15,11,11,10, 8, 6, 8,12, 6 };const UINT8 systemFontWidths16PointAll[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 4, 4, 6, 8, 8,11, 9, 5, 4, 4, 6, 8, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 8, 8, 8, 8, 14, 8,10, 9,10, 9, 8,10,10, 4, 7, 9, 8,12,10,10, 9,10,10, 9, 8,10, 8,14, 9,10, 9, 4, 4, 4, 5, 8, 5, 8, 8, 7, 8, 8, 4, 8, 8, 4, 4, 7, 4,12, 8, 8, 8, 8, 5, 8, 4, 8, 8,10, 8, 8, 8, 5, 4, 5, 5, 4 };const UINT8 systemFontWidths36PointAll[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 8, 8,12,16,16,22,18,10, 8, 8,12,16, 8, 8, 8, 8, 16,16,16,16,16,16,16,16,16,16, 8, 8,16,16,16,16, 27/*?*/,16,20,18,20,18,16,20,20, 8,14,18,16,24/*?*/,20,20, 18,20,20,18,16,20,16,28,18,20,18, 8, 8, 8,10,16, 10,16,16,14,16,16, 8,16,16, 8, 8,14, 8,24/**?**/,16,16, 16,16,10,16, 8,16,16,20,16,16,16,10, 8,10,10, 8 };const UINT8 systemFontWidths48PointAll[ SBCS_NUM_CHARS - SBCS_FIRST_NON_CONTROL_CHAR] = { 12,12,18,24,24,33,27,14,12,12,18,24,12,12,12,12, 24,24,24,24,24,24,24,24,24,24,12,12,24,24,24,24, 42,24,30,27,30,27,24,30,30,12,21,27,24,36,30,30, 27,30,30,27,24,30,24,42,27,30,27,12,12,12,15,24, 15,24,24,21,24,24,12,24,24,12,12,21,12,36,24,24, 24,24,15,24,12,24,24,30,24,24,24,15,12,15,15,12 };#define UNKNOWN_CHAR_CONVERSION 0x20#define UNDEFINED_CHAR_CONVERSION 0x00#define FIRST_UPPER_128_CHAR_INDEX 0x80/* 0x80 up to the defined value are unspecified for all these: */#define FIRST_UPPER_ISO_8859_1_INDEX 0xA0#define FIRST_UPPER_ISO_8859_2_INDEX 0xA0#define FIRST_UPPER_ISO_8859_5_INDEX 0xA0 #define FIRST_UPPER_ISO_8859_6_INDEX 0xA0#define FIRST_UPPER_ISO_8859_7_INDEX 0xA0#define FIRST_UPPER_ISO_8859_8_INDEX 0xA0#define FIRST_UPPER_ISO_8859_9_INDEX 0xA0#define FIRST_UPPER_ISO_8859_11_INDEX 0xA0#define FIRST_UPPER_ISO_8859_13_INDEX 0xA0/* Each lower-case char is 0x20 higher than the upper case one in the conversion to windows-1251 from KOI8-R: */#define KOI8_R_LOWER_CASE_CHAR_OFFSET 0x20 #define UPPER_128_CHAR_COUNT 0x80////mac-roman to iso8859-1: (http://czyborra.com/charsets/mac-roman.gif)//_______________________////(starting at 0x80)://XXXEH- those prefaced by a "/*?*/" mean that the value therein is a// good (?) substite. "/*?|x*/ means that x might also be a good subsitute:const UINT8 macRoman_to_iso88591[UPPER_128_CHAR_COUNT] = { /*0x80:*/ 0xc4, 0xc5, 0xc7, 0xc9, 0xd1, 0xd6, 0xdc, 0xe1, /*0x88:*/0xe0, 0xe2, 0xe4, 0xe3, 0xe5, 0xe7, 0xe9, 0xe8, /*0x90:*/0xea, 0xeb, 0xed, 0xec, 0xee, 0xef, 0xf1, 0xf3, /*0x98:*/0xf2, 0xf4, 0xf6, 0xf5, 0xfa, 0xf9, 0xFB, 0xFC, /*0xA0:*/UNKNOWN_CHAR_CONVERSION, 0xB0, 0xA2, 0xA3, 0xA7, /*?*/0xB7, 0xB6, 0xDF, /*0xA8:*/0xAE, 0xA9, /*?*/0x99, 0xB4, 0xA8, /*?|0x3D*/0x2F, 0xC6, 0xD8, /*0xB0:*/UNKNOWN_CHAR_CONVERSION, 0xB1, /*?|0x5F*/0x3C, /*?|0x5F*/0x3E, 0xA5, 0xB5, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, /*0xB8:*/UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xAA, 0xBA, UNKNOWN_CHAR_CONVERSION, 0xE6, 0xF8, /*0xC0:*/0xBF, 0xA1, 0xAC, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xAB, /*0xC8:*/0xBB, UNKNOWN_CHAR_CONVERSION, 0xA0, 0xC0, 0xC3, 0xD5, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, /*0xD0:*/UNKNOWN_CHAR_CONVERSION, 0xAD, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xF7, UNKNOWN_CHAR_CONVERSION, /*0xD8:*/0xFF, UNKNOWN_CHAR_CONVERSION, /*?*/0x2F, 0xA4, /*?*/0x3C, /*?*/0x3E, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, /*0xE0:*/UNKNOWN_CHAR_CONVERSION, 0xB7, 0xB8, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xC2, 0xCA, 0xC1, /*0xE8:*/0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0xD3, 0xD3, /*0xF0:*/UNKNOWN_CHAR_CONVERSION, 0xD2, 0xDA, 0xDB, 0xD9, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, /*0xF8:*/0xAF, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xB8, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION };////iso8859-1 to mac-roman:// (http://czyborra.com/charsets/iso8859.html#ISO-8859-1)//_______________________////(starting at 0x80):const UINT8 iso88591_to_macRoman[UPPER_128_CHAR_COUNT] = { /*0x80:*/UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, /*0x88:*/UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, /*0x90:*/UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, /*0x98:*/UNDEFINED_CHAR_CONVERSION, 0xAA, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, UNDEFINED_CHAR_CONVERSION, /*0xA0:*/0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, UNKNOWN_CHAR_CONVERSION, 0xA4, /*0xA8:*/0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0xD1, 0xA8, 0xF8, /*0xB0:*/0xA1, 0xB1, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xAB, 0xB5, 0xA6,/*|0xA5?*/0xE1, /*0xB8:*/ /*|0xE2?*/0xFC, UNKNOWN_CHAR_CONVERSION, 0xBC, 0xC8, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xC0, /*0xC0:*/0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82, /*0xC8:*/0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC, /*0xD0:*/UNKNOWN_CHAR_CONVERSION, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, /*?:use small 'x' for multiply sign:*/0x78, /*0xD8:*/0xAF, 0xF4, 0xF2, 0xF3, 0x86, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xA7, /*0xE0:*/0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D, /*0xE8:*/0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95, /*0xF0:*/UNKNOWN_CHAR_CONVERSION, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6, /*0xF8:*/0xBF, 0x9D, 0x9C, 0x9E, 0x9F, UNKNOWN_CHAR_CONVERSION, UNKNOWN_CHAR_CONVERSION, 0xD8 };const UINT8 iso88595_to_windows1251_A0_to_AF[16] = { /*0xA0:*/0xA0, 0xA8, 0x80, 0x81, 0xAA, 0xBD, 0xB2, 0xAF, 0xA3, 0x8A, 0x8C, 0x8E, 0x8D, 0xAD, 0xA1, 0x8F };const UINT8 iso88595_to_windows1251_F0_to_FF[16] = { /*0xF0:*/0xB9, 0xB8, 0x90, 0x83, 0xBA, 0xBE, 0xB3, 0xBF, 0xBC, 0x9A, 0x9C, 0x9E, 0x9D, 0xA7, 0xA2, 0x9F };const UINT8 koi8r_to_windows1251_E0_to_FF[32] = { /*0xE0:*/ 0xDE, 0xC0, 0xC1, 0xD6, 0xC4, 0xC5, 0xD4, 0xC3, 0xD5, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, /*0xF0:*/ 0xCF, 0xDF, 0xD0, 0xD1, 0xD2, 0xD3, 0xC6, 0xC2, 0xDC, 0xDB, 0xC7, 0xD8, 0xDD, 0xD9, 0xD7, 0xDA };///////////////////////////////////////////////////////////////////////////////// This function converts text that was authored in the mac-roman charset// to iso-8859-1 if we're in a renderer on a non-Mac machine, and vice// versa.//// Returns FALSE if there was a problem, e.g., pBuf NULL.//BOOL ConvertAcrossCharacterSets(_CHAR* pBuf, ULONG32 ulCharset, BOOL bRendererIsCallingThis, UINT16 uiMaxSupportedLevel){ if (!pBuf) { return FALSE; } else if (!bRendererIsCallingThis) { return TRUE; //nothing to do! We only want to convert in renderer. }#if defined(_MACINTOSH) if(CHARSET__us_ascii == ulCharset || CHARSET__iso_8859_1 == ulCharset) { //Charset when authored was not mac-roman so we need to convert all // above 128 (0x80) to Mac chars for display on this Mac if authored // in the iso-8859-1 or us-ascii charset. Note that iso-8859-1 doesn't // define what characters are in the range from 0x80 to 0x9F: while (*pBuf) { if ((UINT8)(*pBuf) >= (UINT8)FIRST_UPPER_128_CHAR_INDEX) { _CHAR tmpCh = iso88591_to_macRoman[ (UINT8)(*pBuf) - (UINT8)FIRST_UPPER_128_CHAR_INDEX]; //Don't translate if there is no matching character: if (UNKNOWN_CHAR_CONVERSION != tmpCh && UNDEFINED_CHAR_CONVERSION != tmpCh) { *pBuf = tmpCh; } } pBuf++; } goto cleanup; } if (uiMaxSupportedLevel < 1) // /RealText 1.0 is level 0 only. { goto cleanup;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -