home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / intlwin.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.0 KB  |  122 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef __INTLWIN_H
  20. #define __INTLWIN_H
  21.  
  22. #define DEFAULT_WINCSID 0
  23.  
  24. #define MAXLANGNUM 11
  25.  
  26. class    CyaFont;
  27.  
  28. typedef struct EncodingInfo
  29. {
  30.     int  iLangResId ;                // Language Resource ID 
  31.     int  iCSID;                         // Font's csid which defined by csid.h
  32.     char szPropName[LF_FACESIZE];     // Proportional font name
  33.     int  iPropSize;                    // Proportional font size
  34.     int  iPropCharset;                // Proportional font's charset-id defined MS
  35.     char szFixName[LF_FACESIZE];    // Fix font name
  36.     int  iFixSize;                    // Fix font size 
  37.     int  iFixCharset;                // Fix font's charset-id defined by MS
  38.     int  nCodeset;
  39.     int  csid[5];                    // Supported charset list per language
  40. }  EncodingInfo;
  41.  
  42.  
  43. class CIntlFont 
  44. {
  45. // Constructor
  46. public:
  47.     CIntlFont();  // this will setup font tables
  48.  
  49. private:
  50.     EncodingInfo *pEncodingInfoTbl;
  51.     int nEncoding;
  52.  
  53. public:   // Control functions for Font Table
  54.     void WriteToIniFile(void);
  55.     int  DocCSIDtoID(int doc_csid);
  56.     EncodingInfo *GetEncodingInfo (int id);
  57.     EncodingInfo *GetEncodingInfo (MWContext *pContext);
  58.     void ChangeFont(int id, struct EncodingInfo *ef_font);
  59.     char * GetEncodingName(int id);
  60. };
  61.  
  62.  
  63. #define TABLE_UNICODE_API_FLAG 1
  64.  
  65. #define MAX_FLAG_TABLE_NUM    0x100
  66. #define MASK_FLAG_TABLE        0xFF
  67.  
  68. class CIntlWin
  69. {
  70. public:
  71. #ifdef XP_WIN32
  72.     static LPWSTR  m_wConvBuf;
  73. #endif
  74.     static int       m_iConvBufSize;
  75.     static BOOL AllocConvBuffer(int iLength);
  76. public:
  77.     static BOOL FontSelectIgnorePitch(int16 wincsid); 
  78.     static BOOL FontSelectIgnoreCharset(int16 wincsid); 
  79.     static BOOL TextOutWithCyaFont(CyaFont *theNSFont, int16 wincsid, HDC hDC,  
  80.                                   int nXStart, int nYStart, LPCSTR  lpString,int  iLength);
  81.     static BOOL GetTextExtentPointWithCyaFont(CyaFont *theNSFont, int wincsid, HDC hDC, LPCSTR lpString, int cbString, LPSIZE lpSize);
  82.  
  83.     static int MultiByteToWideChar(int16 wincsid, LPCSTR lpMultiByte, int len);
  84.     static CSize GetTextExtent(int16 wincsid, HDC pDC, LPCTSTR pString, int iLength);
  85.     static BOOL TextOut(int16 wincsid, HDC pDC, int nXStart, int nYStart, LPCSTR  lpString,int  iLength);
  86.     static BOOL GetTextExtentPoint(int wincsid, HDC hDC, LPCSTR lpString, int cbString, LPSIZE lpSize);
  87.     static BOOL ExtTextOut(int16 wincsid, HDC pDC, int x, int y, UINT nOptions, LPCRECT lpRect, LPCSTR lpszString, UINT nCount, LPINT lpDxWidths);
  88. #ifdef XP_WIN32
  89.     static int DrawTextEx(int16 wincsid, HDC hdc, LPSTR lpchText, int cchText,LPRECT lprc,UINT dwDTFormat,LPDRAWTEXTPARAMS lpDTParams);
  90. #endif
  91.     static int DrawText(int16 wincsid, HDC hdc, LPSTR lpchText, int cchText,LPRECT lprc,UINT dwDTFormat);
  92.  
  93. private:
  94.     static int16  m_system_locale_csid;
  95. //#ifdef netscape_font_module
  96. public:
  97. //private:
  98. //#endif // netscape_font_module
  99.  
  100. #ifdef XP_WIN32
  101.     inline static BOOL UseUnicodeFontAPI(int16 wincsid) { return flagTable[(wincsid) & MASK_FLAG_TABLE];};
  102. #else
  103.     inline static BOOL UseUnicodeFontAPI(int16 wincsid) { return FALSE; };
  104. #endif
  105.     static BOOL UseVirtualFont(); 
  106.  
  107.     static int16 GetSystemLocaleCsid();
  108.     static int16 CodePageToCsid(UINT cp);
  109.  
  110. #ifdef XP_WIN32
  111.     static BOOL flagTable[MAX_FLAG_TABLE_NUM];
  112. #endif
  113. };
  114.  
  115. int16 IntlCharsetToCsid(BYTE charset);
  116. BYTE IntlGetLfCharset(int csid);
  117. const char *IntlGetUIPropFaceName(int csid);
  118. const char *IntlGetUIFixFaceName(int csid);
  119.  
  120. #endif
  121.  
  122.