Home | History | Annotate | Download | only in hb-icu-le
      1 
      2 /*
      3  *******************************************************************************
      4  *
      5  *   Copyright (C) 1999-2008, International Business Machines
      6  *   Corporation and others.  All Rights Reserved.
      7  *
      8  *******************************************************************************
      9  *   file name:  PortableFontInstance.h
     10  *
     11  *   created on: 11/12/1999
     12  *   created by: Eric R. Mader
     13  */
     14 
     15 #ifndef __PORTABLEFONTINSTANCE_H
     16 #define __PORTABLEFONTINSTANCE_H
     17 
     18 #define HB_H_IN
     19 #include <hb-font.h>
     20 #include <hb-blob.h>
     21 
     22 #include "layout/LETypes.h"
     23 #include "layout/LEFontInstance.h"
     24 #include "letest.h"
     25 
     26 #include "FontTableCache.h"
     27 
     28 #include "cmaps.h"
     29 
     30 HB_BEGIN_VISIBILITY
     31 
     32 class PortableFontInstance : public LEFontInstance, protected FontTableCache
     33 {
     34 private:
     35     hb_face_t *fFace;
     36 
     37     float     fXScale;
     38     float     fYScale;
     39     le_int32  fUnitsPerEM;
     40     le_int32  fAscent;
     41     le_int32  fDescent;
     42     le_int32  fLeading;
     43 
     44     const NAMETable *fNAMETable;
     45     le_uint16 fNameCount;
     46     le_uint16 fNameStringOffset;
     47 
     48     CMAPMapper *fCMAPMapper;
     49 
     50     const HMTXTable *fHMTXTable;
     51     le_uint16 fNumGlyphs;
     52     le_uint16 fNumLongHorMetrics;
     53 
     54     void getMetrics();
     55 
     56     CMAPMapper *findUnicodeMapper();
     57 
     58 protected:
     59     hb_blob_t *readFontTable(LETag tableTag) const;
     60 
     61 public:
     62     PortableFontInstance(hb_face_t *face, float xScale, float yScale, LEErrorCode &status);
     63 
     64     virtual ~PortableFontInstance();
     65 
     66     virtual const void *getFontTable(LETag tableTag) const;
     67 
     68     virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
     69 
     70     virtual const LEUnicode16 *getUnicodeNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
     71 
     72     virtual void deleteNameString(const char *name) const;
     73 
     74     virtual void deleteNameString(const LEUnicode16 *name) const;
     75 
     76     virtual le_int32 getUnitsPerEM() const;
     77 
     78     virtual le_uint32 getFontChecksum() const;
     79 
     80     virtual le_int32 getAscent() const;
     81 
     82     virtual le_int32 getDescent() const;
     83 
     84     virtual le_int32 getLeading() const;
     85 
     86     // We really want to inherit this method from the superclass, but some compilers
     87     // issue a warning if we don't implement it...
     88     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper, le_bool filterZeroWidth) const;
     89 
     90     // We really want to inherit this method from the superclass, but some compilers
     91     // issue a warning if we don't implement it...
     92     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch, const LECharMapper *mapper) const;
     93 
     94     virtual LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
     95 
     96     virtual void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
     97 
     98     virtual le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
     99 
    100     virtual float getXPixelsPerEm() const;
    101 
    102     virtual float getYPixelsPerEm() const;
    103 
    104     virtual float getScaleFactorX() const;
    105 
    106     virtual float getScaleFactorY() const;
    107 
    108 };
    109 
    110 HB_END_VISIBILITY
    111 
    112 #endif
    113