00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SkAutoKern_DEFINED
00019 #define SkAutoKern_DEFINED
00020
00021 #include "SkScalerContext.h"
00022
00023 #define SkAutoKern_AdjustF(prev, next) (((next) - (prev) + 32) >> 6 << 16)
00024 #define SkAutoKern_AdjustS(prev, next) SkIntToScalar(((next) - (prev) + 32) >> 6)
00025
00026
00027
00028
00029
00030
00031 class SkAutoKern {
00032 public:
00033 SkAutoKern() : fPrevRsbDelta(0) {}
00034
00035 SkFixed adjust(const SkGlyph& glyph)
00036 {
00037
00038
00039
00040 #if 0
00041 int distort = fPrevRsbDelta - glyph.fLsbDelta;
00042
00043 fPrevRsbDelta = glyph.fRsbDelta;
00044
00045 if (distort >= 32)
00046 return -SK_Fixed1;
00047 else if (distort < -32)
00048 return +SK_Fixed1;
00049 else
00050 return 0;
00051 #else
00052 SkFixed adjust = SkAutoKern_AdjustF(fPrevRsbDelta, glyph.fLsbDelta);
00053 fPrevRsbDelta = glyph.fRsbDelta;
00054 return adjust;
00055 #endif
00056 }
00057 private:
00058 int fPrevRsbDelta;
00059 };
00060
00061 #endif
00062