aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-22 00:37:34 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-22 00:37:34 +0000
commit25d5ab0c0e3d158d301c3a7e89d904adbf4864f4 (patch)
treed41d3bc9424c4c3fd6f64c49a1568a1e6ed1b1ca
parent53872fb937f0195c31b05a47d5af238e3c42d14f (diff)
remove obsolete/unsupported font backend
git-svn-id: http://skia.googlecode.com/svn/trunk@8320 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/ports/SkFontHost_ascender.cpp227
1 files changed, 0 insertions, 227 deletions
diff --git a/src/ports/SkFontHost_ascender.cpp b/src/ports/SkFontHost_ascender.cpp
deleted file mode 100644
index 51210d9642..0000000000
--- a/src/ports/SkFontHost_ascender.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SkScalerContext.h"
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "SkDescriptor.h"
-#include "SkFDot6.h"
-#include "SkFontHost.h"
-#include "SkMask.h"
-#include "SkStream.h"
-#include "SkString.h"
-#include "SkThread.h"
-#include "SkTemplates.h"
-
-#include <acaapi.h>
-
-//////////////////////////////////////////////////////////////////////////
-
-class SkScalerContext_Ascender : public SkScalerContext {
-public:
- SkScalerContext_Ascender(const SkDescriptor* desc);
- virtual ~SkScalerContext_Ascender();
-
-protected:
- virtual unsigned generateGlyphCount();
- virtual uint16_t generateCharToGlyph(SkUnichar uni);
- virtual void generateMetrics(SkGlyph* glyph);
- virtual void generateImage(const SkGlyph& glyph);
- virtual void generatePath(const SkGlyph& glyph, SkPath* path);
- virtual void generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my);
-
-private:
- aca_FontHandle fHandle;
- void* fWorkspace;
- void* fGlyphWorkspace;
- SkStream* fFontStream;
- SkStream* fHintStream;
-};
-
-///////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////
-
-SkScalerContext_Ascender::SkScalerContext_Ascender(const SkDescriptor* desc)
- : SkScalerContext(desc)
-{
- int size = aca_Get_FontHandleRec_Size();
- fHandle = (aca_FontHandle)sk_malloc_throw(size);
-
- // get the pointer to the font
-
- fFontStream = new SkMMAPStream("/UcsGB2312-Hei-H.FDL");
- fHintStream = new SkMMAPStream("/genv6-23.bin");
-
- void* hints = sk_malloc_throw(fHintStream->getLength());
- memcpy(hints, fHintStream->getMemoryBase(), fHintStream->getLength());
-
- aca_Create_Font_Handle(fHandle,
- (void*)fFontStream->getMemoryBase(), fFontStream->getLength(),
- "fred",
- hints, fHintStream->getLength());
-
- // compute our factors from the record
-
- SkMatrix m;
-
- fRec.getSingleMatrix(&m);
-
- // now compute our scale factors
- SkScalar sx = m.getScaleX();
- SkScalar sy = m.getScaleY();
-
- int ppemX = SkScalarRound(sx);
- int ppemY = SkScalarRound(sy);
-
- size = aca_Find_Font_Memory_Required(fHandle, ppemX, ppemY);
- size *= 8; // Jeff suggests this :)
- fWorkspace = sk_malloc_throw(size);
- aca_Set_Font_Memory(fHandle, (uint8_t*)fWorkspace, size);
-
- aca_GlyphAttribsRec rec;
-
- memset(&rec, 0, sizeof(rec));
- rec.xSize = ppemX;
- rec.ySize = ppemY;
- rec.doAdjust = true;
- rec.doExceptions = true;
- rec.doGlyphHints = true;
- rec.doInterpolate = true;
- rec.grayMode = 2;
- aca_Set_Font_Attributes(fHandle, &rec, &size);
-
- fGlyphWorkspace = sk_malloc_throw(size);
- aca_Set_Glyph_Memory(fHandle, fGlyphWorkspace);
-}
-
-SkScalerContext_Ascender::~SkScalerContext_Ascender()
-{
- delete fHintStream;
- delete fFontStream;
- sk_free(fGlyphWorkspace);
- sk_free(fWorkspace);
- sk_free(fHandle);
-}
-
-unsigned SkScalerContext_Ascender::generateGlyphCount()
-{
- return 1000;
-}
-
-uint16_t SkScalerContext_Ascender::generateCharToGlyph(SkUnichar uni)
-{
- return (uint16_t)(uni & 0xFFFF);
-}
-
-void SkScalerContext_Ascender::generateMetrics(SkGlyph* glyph)
-{
- glyph->fRsbDelta = 0;
- glyph->fLsbDelta = 0;
-
- aca_GlyphImageRec rec;
- aca_Vector topLeft;
-
- int adv = aca_Get_Adv_Width(fHandle, glyph->getGlyphID());
- if (aca_GLYPH_NOT_PRESENT == adv)
- goto ERROR;
-
- aca_Rasterize(glyph->getGlyphID(), fHandle, &rec, &topLeft);
-
- if (false) // error
- {
-ERROR:
- glyph->fWidth = 0;
- glyph->fHeight = 0;
- glyph->fTop = 0;
- glyph->fLeft = 0;
- glyph->fAdvanceX = 0;
- glyph->fAdvanceY = 0;
- return;
- }
-
- glyph->fWidth = rec.width;
- glyph->fHeight = rec.rows;
- glyph->fRowBytes = rec.width;
- glyph->fTop = -topLeft.y;
- glyph->fLeft = topLeft.x;
- glyph->fAdvanceX = SkIntToFixed(adv);
- glyph->fAdvanceY = SkIntToFixed(0);
-}
-
-void SkScalerContext_Ascender::generateImage(const SkGlyph& glyph)
-{
- aca_GlyphImageRec rec;
- aca_Vector topLeft;
-
- aca_Rasterize(glyph.getGlyphID(), fHandle, &rec, &topLeft);
-
- const uint8_t* src = (const uint8_t*)rec.buffer;
- uint8_t* dst = (uint8_t*)glyph.fImage;
- int height = glyph.fHeight;
-
- src += rec.y0 * rec.pitch + rec.x0;
- while (--height >= 0)
- {
- memcpy(dst, src, glyph.fWidth);
- src += rec.pitch;
- dst += glyph.fRowBytes;
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-void SkScalerContext_Ascender::generatePath(const SkGlyph& glyph, SkPath* path)
-{
- SkRect r;
-
- r.set(0, 0, SkIntToScalar(4), SkIntToScalar(4));
- path->reset();
- path->addRect(r);
-}
-
-void SkScalerContext_Ascender::generateFontMetrics(SkPaint::FontMetrics* mx, SkPaint::FontMetrics* my)
-{
- if (NULL == mx && NULL == my)
- return;
-
- if (mx)
- {
- mx->fTop = SkIntToScalar(-16);
- mx->fAscent = SkIntToScalar(-16);
- mx->fDescent = SkIntToScalar(4);
- mx->fBottom = SkIntToScalar(4);
- mx->fLeading = 0;
-
- // FIXME:
- mx->fAvgCharWidth = 0;
- mx->fXMin = 0;
- mx->fXMax = 0;
- mx->fXHeight = 0;
- }
- if (my)
- {
- my->fTop = SkIntToScalar(-16);
- my->fAscent = SkIntToScalar(-16);
- my->fDescent = SkIntToScalar(4);
- my->fBottom = SkIntToScalar(4);
- my->fLeading = 0;
-
- // FIXME:
- my->fAvgCharWidth = 0;
- my->fXMin = 0;
- my->fXMax = 0;
- my->fXHeight = 0;
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-
-SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc)
-{
- return SkNEW_ARGS(SkScalerContext_Ascender, (desc));
-}