summaryrefslogtreecommitdiff
path: root/rsFont.cpp
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-02-25 09:34:33 -0800
committerAlex Sakhartchouk <alexst@google.com>2011-02-25 09:34:33 -0800
commit02000b3cdcb2ac369bd06313932b26d4b8e023a9 (patch)
tree44b367a91700fa6648086db501799096839c87f1 /rsFont.cpp
parent8ceb281cdc9297a7dbbedb790b0e2acb5bd146f7 (diff)
downloadrs-02000b3cdcb2ac369bd06313932b26d4b8e023a9.tar.gz
Moving dependency includes out of librs headers.
When we want to use it on the host, we shouldn't need to go hunting for every external dependency Change-Id: I885262acdcdf5ede4a9392235f35d5e2f7038e8b
Diffstat (limited to 'rsFont.cpp')
-rw-r--r--rsFont.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/rsFont.cpp b/rsFont.cpp
index 8a5ab99e..1c1bc989 100644
--- a/rsFont.cpp
+++ b/rsFont.cpp
@@ -20,6 +20,9 @@
#include "rsFont.h"
#include "rsProgramFragment.h"
#include <cutils/properties.h>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
#include FT_BITMAP_H
#include <GLES/gl.h>
@@ -208,7 +211,7 @@ void Font::renderUTF(const char *text, uint32_t len, int32_t x, int32_t y,
}
}
- penX += (cachedGlyph->mAdvance.x >> 6);
+ penX += (cachedGlyph->mAdvanceX >> 6);
// If we were given a specific number of glyphs, decrement
if (numGlyphs > 0) {
@@ -238,7 +241,8 @@ void Font::updateGlyphCache(CachedGlyphInfo *glyph) {
return;
}
- glyph->mAdvance = mFace->glyph->advance;
+ glyph->mAdvanceX = mFace->glyph->advance.x;
+ glyph->mAdvanceY = mFace->glyph->advance.y;
glyph->mBitmapLeft = mFace->glyph->bitmap_left;
glyph->mBitmapTop = mFace->glyph->bitmap_top;
@@ -803,6 +807,22 @@ void FontState::deinit(Context *rsc) {
}
}
+bool FontState::CacheTextureLine::fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) {
+ if ((uint32_t)bitmap->rows > mMaxHeight) {
+ return false;
+ }
+
+ if (mCurrentCol + (uint32_t)bitmap->width < mMaxWidth) {
+ *retOriginX = mCurrentCol;
+ *retOriginY = mCurrentRow;
+ mCurrentCol += bitmap->width;
+ mDirty = true;
+ return true;
+ }
+
+ return false;
+}
+
namespace android {
namespace renderscript {