This file is indexed.

/usr/include/oce/Font_FTFont.hxx is in liboce-visualization-dev 0.18.2-2build1.

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
// Created on: 2013-01-28
// Created by: Kirill GAVRILOV
// Copyright (c) 2013-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.

#ifndef _Font_FTFont_H__
#define _Font_FTFont_H__

#include <NCollection_Vec2.hxx>
#include <NCollection_String.hxx>
#include <Font_FTLibrary.hxx>
#include <Image_PixMap.hxx>
#include <Font_FontAspect.hxx>

//! Wrapper over FreeType font.
//! Notice that this class uses internal buffers for loaded glyphs
//! and it is absolutely UNSAFE to load/read glyph from concurrent threads!
class Font_FTFont : public Standard_Transient
{

public:

  //! Auxiliary structure - rectangle definition
  struct Rect
  {
    float Left;
    float Right;
    float Top;
    float Bottom;

    NCollection_Vec2<float>& TopLeft (NCollection_Vec2<float>& theVec) const
    {
      theVec.x() = Left;
      theVec.y() = Top;
      return theVec;
    }

    NCollection_Vec2<float>& TopRight (NCollection_Vec2<float>& theVec) const
    {
      theVec.x() = Right;
      theVec.y() = Top;
      return theVec;
    }

    NCollection_Vec2<float>& BottomLeft (NCollection_Vec2<float>& theVec) const
    {
      theVec.x() = Left;
      theVec.y() = Bottom;
      return theVec;
    }

    NCollection_Vec2<float>& BottomRight (NCollection_Vec2<float>& theVec) const
    {
      theVec.x() = Right;
      theVec.y() = Bottom;
      return theVec;
    }

  };

public:

  //! Create uninitialized instance.
  Standard_EXPORT Font_FTFont (const Handle(Font_FTLibrary)& theFTLib = NULL);

  //! Destructor.
  Standard_EXPORT virtual ~Font_FTFont();

  //! @return true if font is loaded
  inline bool IsValid() const
  {
    return myFTFace != NULL;
  }

  //! @return image plane for currently rendered glyph
  inline const Image_PixMap& GlyphImage() const
  {
    return myGlyphImg;
  }

  //! Initialize the font.
  //! @param theFontPath   path to the font
  //! @param thePointSize  the face size in points (1/72 inch)
  //! @param theResolution the resolution of the target device in dpi
  //! @return true on success
  Standard_EXPORT bool Init (const NCollection_String& theFontPath,
                             const unsigned int        thePointSize,
                             const unsigned int        theResolution = 72);

  //! Initialize the font.
  //! @param theFontName   the font name
  //! @param theFontAspect the font style
  //! @param thePointSize  the face size in points (1/72 inch)
  //! @param theResolution the resolution of the target device in dpi
  //! @return true on success
  Standard_EXPORT bool Init (const NCollection_String& theFontName,
                             const Font_FontAspect     theFontAspect,
                             const unsigned int        thePointSize,
                             const unsigned int        theResolution);

  //! Release currently loaded font.
  Standard_EXPORT virtual void Release();

  //! Render specified glyph into internal buffer (bitmap).
  Standard_EXPORT bool RenderGlyph (const Standard_Utf32Char theChar);

  //! @return maximal glyph width in pixels (rendered to bitmap).
  Standard_EXPORT unsigned int GlyphMaxSizeX() const;

  //! @return maximal glyph height in pixels (rendered to bitmap).
  Standard_EXPORT unsigned int GlyphMaxSizeY() const;

  //! @return vertical distance from the horizontal baseline to the highest character coordinate.
  inline float Ascender() const
  {
    return float(myFTFace->ascender) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
  }

  //! @return vertical distance from the horizontal baseline to the lowest character coordinate.
  inline float Descender() const
  {
    return float(myFTFace->descender) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
  }

  //! @return default line spacing (the baseline-to-baseline distance).
  inline float LineSpacing() const
  {
    return float(myFTFace->height) * (float(myFTFace->size->metrics.y_ppem) / float(myFTFace->units_per_EM));
  }

  //! Configured point size
  unsigned int PointSize() const
  {
    return myPointSize;
  }

  //! Compute advance to the next character with kerning applied when applicable.
  //! Assuming text rendered horizontally.
  Standard_EXPORT float AdvanceX (const Standard_Utf32Char theUCharNext);

  //! Compute advance to the next character with kerning applied when applicable.
  //! Assuming text rendered horizontally.
  Standard_EXPORT float AdvanceX (const Standard_Utf32Char theUChar,
                                  const Standard_Utf32Char theUCharNext);

  //! Compute advance to the next character with kerning applied when applicable.
  //! Assuming text rendered vertically.
  Standard_EXPORT float AdvanceY (const Standard_Utf32Char theUCharNext);

  //! Compute advance to the next character with kerning applied when applicable.
  //! Assuming text rendered vertically.
  Standard_EXPORT float AdvanceY (const Standard_Utf32Char theUChar,
                                  const Standard_Utf32Char theUCharNext);

  //! @return glyphs number in this font.
  inline Standard_Integer GlyphsNumber() const
  {
    return myFTFace->num_glyphs;
  }

  //! Retrieve glyph bitmap rectangle
  inline void GlyphRect (Font_FTFont::Rect& theRect) const
  {
    const FT_Bitmap& aBitmap = myFTFace->glyph->bitmap;
    theRect.Left   = float(myFTFace->glyph->bitmap_left);
    theRect.Top    = float(myFTFace->glyph->bitmap_top);
    theRect.Right  = float(myFTFace->glyph->bitmap_left + (int )aBitmap.width);
    theRect.Bottom = float(myFTFace->glyph->bitmap_top  - (int )aBitmap.rows);
  }

protected:

  //! Convert value to 26.6 fixed-point format for FT library API.
  template <typename theInput_t>
  inline FT_F26Dot6 toFTPoints (const theInput_t thePointSize) const
  {
    return (FT_F26Dot6)thePointSize * 64; 
  }

  //! Convert value from 26.6 fixed-point format for FT library API.
  template <typename theReturn_t, typename theFTUnits_t>
  inline theReturn_t fromFTPoints (const theFTUnits_t theFTUnits) const
  {
    return (theReturn_t)theFTUnits / 64.0f;
  }

protected:

  //! Load glyph without rendering it.
  Standard_EXPORT bool loadGlyph (const Standard_Utf32Char theUChar);

protected:

  Handle(Font_FTLibrary) myFTLib;       //!< handle to the FT library object
  FT_Face                myFTFace;      //!< FT face object
  NCollection_String     myFontPath;    //!< font path
  unsigned int           myPointSize;   //!< point size set by FT_Set_Char_Size
  FT_Int32               myLoadFlags;   //!< default load flags

  Image_PixMap           myGlyphImg;    //!< cached glyph plane
  FT_Vector              myKernAdvance; //!< buffer variable
  Standard_Utf32Char     myUChar;       //!< currently loaded unicode character

public:

  DEFINE_STANDARD_RTTI(Font_FTFont) // Type definition

};

DEFINE_STANDARD_HANDLE(Font_FTFont, Standard_Transient)

#endif // _Font_FTFont_H__