~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/ipecairo/ipefonts.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2009-12-11 21:22:35 UTC
  • mfrom: (4.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20091211212235-5iio4nzpra64snab
Tags: 7.0.10-1
* New upstream.  Closes: #551192.
  - New build-depends: libcairo2-dev, liblua5.1-0-dev, gsfonts
  - patches/config.diff: Remove.  Upstream build system replaced.
  - Runtime lib package changed to libipe7.0.10 from libipe1c2a
  - Devel package renamed to libipe-dev (from libipe1-dev)
  - Package ipe depends on lua5.1 due to ipe-update-master.

* rules: Re-write to use dh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
// --------------------------------------------------------------------
 
3
// CanvasFonts maintains the Freetype fonts for the canvas
 
4
// --------------------------------------------------------------------
 
5
/*
 
6
 
 
7
    This file is part of the extensible drawing editor Ipe.
 
8
    Copyright (C) 1993-2009  Otfried Cheong
 
9
 
 
10
    Ipe is free software; you can redistribute it and/or modify it
 
11
    under the terms of the GNU General Public License as published by
 
12
    the Free Software Foundation; either version 3 of the License, or
 
13
    (at your option) any later version.
 
14
 
 
15
    As a special exception, you have permission to link Ipe with the
 
16
    CGAL library and distribute executables, as long as you follow the
 
17
    requirements of the Gnu General Public License in regard to all of
 
18
    the software in the executable aside from CGAL.
 
19
 
 
20
    Ipe is distributed in the hope that it will be useful, but WITHOUT
 
21
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
22
    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 
23
    License for more details.
 
24
 
 
25
    You should have received a copy of the GNU General Public License
 
26
    along with Ipe; if not, you can find it at
 
27
    "http://www.gnu.org/copyleft/gpl.html", or write to the Free
 
28
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
29
 
 
30
*/
 
31
 
 
32
#ifndef IPEFONTS_H
 
33
#define IPEFONTS_H
 
34
 
 
35
#include "ipebase.h"
 
36
#include "ipegeo.h"
 
37
#include "ipefontpool.h"
 
38
 
 
39
#include <cairo.h>
 
40
 
 
41
//------------------------------------------------------------------------
 
42
 
 
43
struct FT_FaceRec_;
 
44
 
 
45
namespace ipe {
 
46
 
 
47
  class Face {
 
48
  public:
 
49
    Face(int id, const Font &font);
 
50
    ~Face();
 
51
    inline bool matches(int id) const { return id == iId; }
 
52
    inline Font::TType type() const { return iType; }
 
53
    inline int width(int ch) const { return iWidth[ch]; }
 
54
    inline cairo_font_face_t *cairoFont() { return iCairoFont; }
 
55
    int getGlyph(int ch);
 
56
 
 
57
  private:
 
58
    int iId;
 
59
    Font::TType iType;
 
60
    int iGlyphIndex[0x100];
 
61
    int iWidth[0x100];
 
62
    cairo_font_face_t *iCairoFont;
 
63
  };
 
64
 
 
65
  class Fonts {
 
66
  public:
 
67
    static Fonts *New(const FontPool *fontPool);
 
68
    ~Fonts();
 
69
    Face *getFace(int id);
 
70
    static cairo_font_face_t *screenFont();
 
71
    static String freetypeVersion();
 
72
 
 
73
  private:
 
74
    Fonts(const FontPool *fontPool);
 
75
 
 
76
  private:
 
77
    const FontPool *iFontPool;
 
78
 
 
79
    typedef std::list<Face *> FaceSeq;
 
80
    FaceSeq iFaces;
 
81
  };
 
82
 
 
83
} // namespace
 
84
 
 
85
//------------------------------------------------------------------------
 
86
#endif