This file is indexed.

/usr/include/cairomm-1.0/cairomm/scaledfont.h is in libcairomm-1.0-dev 1.10.0-1ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/* Copyright (C) 2006 The cairomm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

#ifndef __CAIROMM_SCALEDFONT_H
#define __CAIROMM_SCALEDFONT_H

#include <cairomm/refptr.h>
#include <cairomm/fontoptions.h>
#include <cairomm/fontface.h>
#include <cairomm/matrix.h>
#include <cairomm/types.h>
#include <vector>

#ifdef CAIRO_HAS_FT_FONT
#include <cairo-ft.h>
#endif // CAIRO_HAS_FT_FONT

namespace Cairo
{

/** A ScaledFont is a font scaled to a particular size and device resolution. It
 * is most useful for low-level font usage where a library or application wants
 * to cache a reference to a scaled font to speed up the computation of metrics.
 */
class ScaledFont
{

public: 
  /** The underlying C cairo object type */
  typedef cairo_scaled_font_t cobject;

  /** Provides acces to the underlying C cairo object */
  inline cobject* cobj() { return m_cobject; }

  /** Provides acces to the underlying C cairo object */
  inline const cobject* cobj() const { return m_cobject; }

#ifndef DOXYGEN_IGNORE_THIS
  // For use only by the cairomm implementation.
  inline ErrorStatus get_status() const
  { return cairo_scaled_font_status(const_cast<cairo_scaled_font_t*>(cobj())); }

  // for RefPtr
  void reference() const { cairo_scaled_font_reference(m_cobject); }
  void unreference() const { cairo_scaled_font_destroy(m_cobject); }
#endif //DOXYGEN_IGNORE_THIS

  /** Create a C++ wrapper object from the C instance.  This C++ object should
   * then be given to a RefPtr.
   */
  explicit ScaledFont(cobject* cobj, bool has_reference = false);

  virtual ~ScaledFont();

  /** Creates a ScaledFont object from a font face and matrices that describe
   * the size of the font and the environment in which it will be used.
   *
   * @param font_face A font face.
   * @param font_matrix font space to user space transformation matrix for the
   * font. In the simplest case of a N point font, this matrix is just a scale
   * by N, but it can also be used to shear the font or stretch it unequally
   * along the two axes. See Context::set_font_matrix().
   * @param ctm user to device transformation matrix with which the font will be
   * used.
   * @param options options to use when getting metrics for the font and
   * rendering with it.
   */
  static RefPtr<ScaledFont> create(const RefPtr<FontFace>& font_face, const Matrix& font_matrix,
      const Matrix& ctm, const FontOptions& options = FontOptions());
  /* To keep 1.6.x ABI  */
  static RefPtr<ScaledFont> create(const RefPtr<FontFace>& font_face, const cairo_matrix_t& font_matrix,
      const cairo_matrix_t& ctm, const FontOptions& options = FontOptions());
  // NOTE: the constructor doesn't take a RefPtr<const FontFace> because the
  // FontFace object can be changed in this constructor (in the case of user
  // fonts, the FontFace becomes immutable, i.e. you can't call any set_*_func()
  // functions any longer)

  //We use an output paramter instead of the return value,
  //for consistency with other get_*extents() methods in other classes,
  //though they should probably all use the return value instead.
  //but it is too late to change that now. murrayc:

  /** Gets the metrics for a ScaledFont
   * @since 1.8
   * */
  void get_extents(FontExtents& extents) const;

  /** @deprecated Use get_extents() instead
   * @since 1.2
   * */
  void extents(FontExtents& extents) const;

  /** Gets the extents for a string of text. The extents describe a user-space
   * rectangle that encloses the "inked" portion of the text drawn at the origin
   * (0,0) (as it would be drawn by Context::show_text() if the cairo graphics
   * state were set to the same font_face, font_matrix, ctm, and font_options as
   * the ScaledFont object).  Additionally, the x_advance and y_advance values
   * indicate the amount by which the current point would be advanced by
   * Context::show_text().
   *
   * Note that whitespace characters do not directly contribute to the size of
   * the rectangle (extents.width and extents.height). They do contribute
   * indirectly by changing the position of non-whitespace characters. In
   * particular, trailing whitespace characters are likely to not affect the
   * size of the rectangle, though they will affect the x_advance and y_advance
   * values.
   *
   * @param utf8  a string of text, encoded in UTF-8.
   * @param extents Returns the extents of the given string.
   *
   * @since 1.8
   */
  void get_text_extents(const std::string& utf8, TextExtents& extents) const;
  /** @deprecated Use get_text_extents() instead
   * @since 1.2
   * */
  void text_extents(const std::string& utf8, TextExtents& extents) const;

  /** Gets the extents for an array of glyphs. The extents describe a user-space
   * rectangle that encloses the "inked" portion of the glyphs, (as they would
   * be drawn by Context::show_glyphs() if the cairo graphics state were set to the
   * same font_face, font_matrix, ctm, and font_options as the ScaledFont
   * object).  Additionally, the x_advance and y_advance values indicate the
   * amount by which the current point would be advanced by Context::show_glyphs().
   *
   * Note that whitespace glyphs do not contribute to the size of the rectangle
   * (extents.width and extents.height).
   *
   * @param glyphs A vector of glyphs to calculate the extents of.
   * @param extents Returns the extents for the array of glyphs.
   *
   * @since 1.8
   **/
  void get_glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& extents);

  /** @deprecated Use get_glyph_extents() instead
   * @since 1.2
   * */
  void glyph_extents(const std::vector<Glyph>& glyphs, TextExtents& extents);

  /** The FontFace with which this ScaledFont was created.
   * @since 1.2
   */
  RefPtr<FontFace> get_font_face() const;

  /** Gets the FontOptions with which the ScaledFont was created.
   * @since 1.2
   */
  void get_font_options(FontOptions& options) const;

  /** Gets the font matrix with which the ScaledFont was created.
   * @since 1.2
   */
  void get_font_matrix(Matrix& font_matrix) const;
  /* To keep 1.6.x ABI  */
  void get_font_matrix(cairo_matrix_t& font_matrix) const;

  /** Gets the CTM with which the ScaledFont was created.
   * @since 1.2
   */
  void get_ctm(Matrix& ctm) const;
  /* To keep 1.6.x ABI  */
  void get_ctm(cairo_matrix_t& ctm) const;

  /** Gets the type of scaled Font
   * @since 1.2
   */
  FontType get_type() const;

  // FIXME: it'd be really nice not to assume a specific container (e.g.
  // std::vector) here
  /**
   * @param x X position to place first glyph.
   * @param y Y position to place first glyph.
   * @param utf8 a string of text encoded in UTF-8.
   * @param glyphs pointer to array of glyphs to fill.
   * @param clusters pointer to array of cluster mapping information to fill.
   * @cluster_flags cluster mapping flags
   *
   * Converts UTF-8 text to an array of glyphs, with cluster mapping, that can be
   * used to render later.
   *
   * For details of how (@a clusters and @a cluster_flags map input
   * UTF-8 text to the output glyphs see Context::show_text_glyphs().
   *
   * The output values can be readily passed to Context::show_text_glyphs()
   * Context::show_glyphs(), or related functions, assuming that the exact
   * same scaled font is used for the operation.
   *
   * @since 1.8
   **/
  void text_to_glyphs(double x,
                      double y,
                      const std::string& utf8,
                      std::vector<Glyph>& glyphs,
                      std::vector<TextCluster>& clusters,
                      TextClusterFlags& cluster_flags);

  /** Stores the scale matrix of this scaled font into matrix. The scale matrix
   * is product of the font matrix and the ctm associated with the scaled font,
   * and hence is the matrix mapping from font space to device space.
   *
   * @param scale_matrix return value for the matrix.
   *
   * @since 1.8
   */
  void get_scale_matrix(Matrix& scale_matrix) const;

protected:
  /* Cairo::Matrix parameters changed to cairo_matrix_t */
  ScaledFont(const RefPtr<FontFace>& font_face, const cairo_matrix_t& font_matrix,
             const cairo_matrix_t& ctm, const FontOptions& options = FontOptions());
  /** The underlying C cairo object that is wrapped by this ScaledFont */
  cobject* m_cobject;

private:
  ScaledFont(const ScaledFont&);
  ScaledFont& operator=(const ScaledFont&);
};

#ifdef CAIRO_HAS_FT_FONT

//TODO: Documentation.
/**
 * @since 1.8
 */
class FtScaledFont : public ScaledFont
{
public:
  /** Creates a ScaledFont From a FtFontFace.
   *
   * @since 1.8
   */
  static RefPtr<FtScaledFont> create(const RefPtr<FtFontFace>& font_face, const Matrix& font_matrix,
      const Matrix& ctm, const FontOptions& options = FontOptions());

  /** Gets the FT_Face object from a FreeType backend font and scales it
   * appropriately for the font. You must release the face with
   * unlock_face() when you are done using it. Since the FT_Face object can be
   * shared between multiple ScaledFont objects, you must not lock any other
   * font objects until you unlock this one. A count is kept of the number of
   * times lock_face() is called.  unlock_face() must be called the same number
   * of times.
   *
   * You must be careful when using this function in a library or in a threaded
   * application, because freetype's design makes it unsafe to call freetype
   * functions simultaneously from multiple threads, (even if using distinct
   * FT_Face objects). Because of this, application code that acquires an
   * FT_Face object with this call must add it's own locking to protect any use
   * of that object, (and which also must protect any other calls into cairo as
   * almost any cairo function might result in a call into the freetype
   * library).
   *
   * @return The FT_Face object for font, scaled appropriately, or NULL if
   * scaled_font is in an error state or there is insufficient memory.
   *
   * @since 1.8
   */
  FT_Face lock_face();

  /** Releases a face obtained with lock_face().
   *
   * @since 1.8
   */
  void unlock_face();

protected:
  FtScaledFont(const RefPtr<FtFontFace>& font_face, const Matrix& font_matrix,
      const Matrix& ctm, const FontOptions& options = FontOptions());
};
#endif // CAIRO_HAS_FT_FONT

}

#endif // __CAIROMM_SCALEDFONT_H
// vim: ts=2 sw=2 et