⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kanjifont.h

📁 Displays the Japanese text
💻 H
字号:
#ifndef _KANJIFONT_H_
#define _KANJIFONT_H_

#include "KanjiInfo.h"
#include <windows.h>

/**
 * @class KanjiFont
 * 
 * Based on JWPce by Glenn Rosenthal
 */
class KanjiFont : protected KanjiInfo {

protected:

  short _width;
	short _height;
  short _leading;
  short _spacing;
  short _hshift;
  short _vshift;
  
public:

	virtual ~KanjiFont() {};

	virtual BOOL TextOut(HDC, int, int, LPCTSTR) = 0;
  virtual BOOL DrawGlyph(HDC hdc, int, int, int) = 0;                       
  virtual BOOL StretchGlyph(HDC hdc, int, const RECT&, bool) = 0;

};


/** 
 * @class TrueTypeKanjiFont
 *
 * Based on JWPce by Glenn Rosenthal
 */
class TrueTypeKanjiFont : public KanjiFont {

	unsigned long SWAPLONG(unsigned long);
	unsigned short SWAPSHORT(unsigned short);

public:

  TrueTypeKanjiFont ();
	virtual ~TrueTypeKanjiFont();

	BOOL CreateFont(HDC hdc,TCHAR *name,int size,bool bVertical = false);

	virtual BOOL TextOut(HDC, int, int, LPCTSTR);
  virtual BOOL DrawGlyph(HDC hdc,int,int,int);
  virtual BOOL StretchGlyph(HDC hdc,int,const RECT&,bool bVertical = false);

protected:

  int FindGlyph(int);
  
private:

  HFONT   font;                 // TrueType font structure.

  char   *cmap;                 // Copy of the cmap structure for this font.
  char   *gsub;                 // GSUB structre for this font, used for viertical glyph replacemnt
  unsigned short   count;                // Number of entries in the cmap subtable.
  unsigned short  *start;                // Start table for ranges                                
  unsigned short  *end;                  // End table for ranges
  unsigned short  *delta;                // Delta table for displacements
  unsigned short  *offset;               // Offest table for entriesinto the glyph table
  unsigned short  *glyph;                // Glyph table.
  unsigned short   vcount;               // Number of vertical replacement glyphs
  unsigned short  *from;                 // Glphys to be replaced.
  unsigned short  *to;                   // replacement glyphs.

};


#ifndef SHIFTJIS_CHARSET                            // This constaint is only defined in Win CE 2.11 and 
  #define SHIFTJIS_CHARSET 0x80                     //   up.  We support TrueType fonts for all versions, but
#endif  SHIFTJIS_CHARSET                            //   must check for Japanese fonts.

#endif jwp_font_h


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -