gecko/gfx/thebes/gfxOS2Fonts.h
Ehsan Akhgari 0fd9123eac Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00

106 lines
3.5 KiB
C++

/* vim: set sw=4 sts=4 et cin: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GFX_OS2_FONTS_H
#define GFX_OS2_FONTS_H
#include "gfxTypes.h"
#include "gfxFont.h"
#include "gfxMatrix.h"
#include "nsDataHashtable.h"
#define INCL_GPI
#include <os2.h>
#include <cairo-os2.h>
#include "cairo-ft.h" // includes fontconfig.h, too
#include <freetype/tttables.h>
#include "nsICharsetConverterManager.h"
class gfxOS2FontEntry : public gfxFontEntry {
public:
gfxOS2FontEntry(const nsAString& aName) : gfxFontEntry(aName) {}
~gfxOS2FontEntry() {}
};
class gfxOS2Font : public gfxFont {
public:
gfxOS2Font(gfxOS2FontEntry *aFontEntry, const gfxFontStyle *aFontStyle);
virtual ~gfxOS2Font();
virtual const gfxFont::Metrics& GetMetrics();
cairo_font_face_t *CairoFontFace();
cairo_scaled_font_t *CairoScaledFont();
// Get the glyphID of a space
virtual uint32_t GetSpaceGlyph() {
if (!mMetrics)
GetMetrics();
return mSpaceGlyph;
}
static already_AddRefed<gfxOS2Font> GetOrMakeFont(const nsAString& aName,
const gfxFontStyle *aStyle);
protected:
virtual bool SetupCairoFont(gfxContext *aContext);
virtual FontType GetType() const { return FONT_TYPE_OS2; }
private:
cairo_font_face_t *mFontFace;
Metrics *mMetrics;
gfxFloat mAdjustedSize;
uint32_t mSpaceGlyph;
int mHinting;
bool mAntialias;
};
class THEBES_API gfxOS2FontGroup : public gfxFontGroup {
public:
gfxOS2FontGroup(const nsAString& aFamilies, const gfxFontStyle* aStyle, gfxUserFontSet *aUserFontSet);
virtual ~gfxOS2FontGroup();
virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle);
// create and initialize the textRun using FreeType font
virtual gfxTextRun *MakeTextRun(const PRUnichar* aString, uint32_t aLength,
const Parameters* aParams, uint32_t aFlags);
virtual gfxTextRun *MakeTextRun(const uint8_t* aString, uint32_t aLength,
const Parameters* aParams, uint32_t aFlags);
gfxOS2Font *GetFontAt(int32_t i) {
// If it turns out to be hard for all clients that cache font
// groups to call UpdateFontList at appropriate times, we could
// instead consider just calling UpdateFontList from someplace
// more central (such as here).
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
"Whoever was caching this font group should have "
"called UpdateFontList on it");
#ifdef DEBUG_thebes_2
printf("gfxOS2FontGroup[%#x]::GetFontAt(%d), %#x, %#x\n",
(unsigned)this, i, (unsigned)&mFonts, (unsigned)&mFonts[i]);
#endif
return static_cast<gfxOS2Font*>(static_cast<gfxFont*>(mFonts[i]));
}
protected:
void InitTextRun(gfxTextRun *aTextRun, const uint8_t *aUTF8Text,
uint32_t aUTF8Length, uint32_t aUTF8HeaderLength);
void CreateGlyphRunsFT(gfxTextRun *aTextRun, const uint8_t *aUTF8,
uint32_t aUTF8Length);
static bool FontCallback(const nsAString& aFontName,
const nsACString& aGenericName,
bool aUseFontSet,
void *aClosure);
private:
bool mEnableKerning;
};
#endif /* GFX_OS2_FONTS_H */