~lidaobing/+junk/zhcon

« back to all changes in this revision

Viewing changes to src/basefont.h

  • Committer: LI Daobing
  • Date: 2008-11-04 04:39:18 UTC
  • Revision ID: lidaobing@gmail.com-20081104043918-nfwwvgfb0uied0mt
importĀ 1:0.2.6-5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// vi:ts=4:shiftwidth=4:expandtab
 
2
/***************************************************************************
 
3
                          basefont.h  -  description
 
4
                             -------------------
 
5
    begin                : Fri Mar 16 2001
 
6
    copyright            : (C) 2001 by ejoy
 
7
    email                : ejoy@users.sourceforge.net
 
8
 ***************************************************************************/
 
9
 
 
10
/***************************************************************************
 
11
 *                                                                         *
 
12
 *   This program is free software; you can redistribute it and/or modify  *
 
13
 *   it under the terms of the GNU General Public License as published by  *
 
14
 *   the Free Software Foundation; either version 2 of the License, or     *
 
15
 *   (at your option) any later version.                                   *
 
16
 *                                                                         *
 
17
 ***************************************************************************/
 
18
 
 
19
#ifndef BASEFONT_H
 
20
#define BASEFONT_H
 
21
 
 
22
/**
 
23
 *@author ejoy
 
24
 */
 
25
#include <string>
 
26
using namespace std;
 
27
//full or half hz when output
 
28
enum CharTag {
 
29
    FULL,LEFT,RIGHT
 
30
};
 
31
 
 
32
class BaseFont {
 
33
    public:
 
34
        BaseFont(string& fn,int w,int h);
 
35
        virtual ~BaseFont();
 
36
        int Width() const {
 
37
            return mWidth;
 
38
        }
 
39
        int Height() const {
 
40
            return mHeight;
 
41
        }
 
42
        int WidthBytes() const {
 
43
            return mWidthBytes;
 
44
        }
 
45
        char *GetChar(char c);
 
46
        char *GetChar(char c1, char c2);
 
47
 
 
48
    protected:
 
49
        /** mmap address of font(or buf) */
 
50
        int mFd;
 
51
        char* mpBuf;
 
52
        char* mpNull;
 
53
        unsigned mBufSize;
 
54
        int mWidth;
 
55
        int mHeight;
 
56
        long mNumChars;
 
57
        unsigned mDataOffset;
 
58
        int mByteLen;  //font size in bytes(not include blankline)
 
59
        int mWidthBytes;
 
60
        void GetInfo();
 
61
};
 
62
#endif