summaryrefslogtreecommitdiff
path: root/libs/rs/rsFont.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/rs/rsFont.cpp')
-rw-r--r--libs/rs/rsFont.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index 8a5ab99e8bad..1c1bc989e0c4 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/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 {