-
Notifications
You must be signed in to change notification settings - Fork 12
/
FontInfo.h
85 lines (74 loc) · 2.53 KB
/
FontInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* -*- C++ -*-
*
* FontInfo.h - Font information storage class of ONScripter
*
* Copyright (c) 2001-2007 Ogapee. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __FONT_INFO_H__
#define __FONT_INFO_H__
#include <SDL.h>
#include "Encoding.h"
typedef unsigned char uchar3[3];
// OS X pollutes the main namespace with its own FontInfo type, so we
// have to use something else.
class Fontinfo {
public:
enum { YOKO_MODE = 0,
TATE_MODE = 1
};
void *ttf_font;
uchar3 color;
uchar3 on_color, off_color, nofile_color;
int font_size_xy[2];
int top_xy[2]; // Top left origin
int num_xy[2]; // Row and column of the text windows
int xy[2]; // Current position
int pitch_xy[2]; // Width and height of a character
int wait_time;
bool is_bold;
bool is_shadow;
bool is_transparent;
bool is_newline_accepted;
uchar3 window_color;
int line_offset_xy[2]; // ruby offset for each line
int ruby_offset_xy[2]; // ruby offset for the whole sentence
bool rubyon_flag;
int tateyoko_mode;
Fontinfo();
void reset();
void *openFont( char *font_file, int ratio1, int ratio2 );
void setTateyokoMode( int tateyoko_mode );
int getTateyokoMode();
int getRemainingLine();
int x(int encoding);
int y();
void setXY( int x=-1, int y=-1 );
void clear();
void newLine();
void setLineArea(int num);
bool isEndOfLine(int margin=0);
bool isLineEmpty();
void advanceCharInHankaku(int offest);
void addLineOffset(int margin);
void setRubyOnFlag(bool flag);
SDL_Rect calcUpdatedArea(int start_xy[2], int ratio1, int ratio2, int encoding);
void addShadeArea(SDL_Rect &rect, int shade_distance[2] );
int initRuby(Fontinfo &body_info, int body_count, int ruby_count, int encoding);
};
#endif // __FONT_INFO_H__