39 |
RealFont(Text::Font *f) : f(f) { |
RealFont(Text::Font *f) : f(f) { |
40 |
rend = new Renderables::TextRenderer(f); |
rend = new Renderables::TextRenderer(f); |
41 |
} |
} |
42 |
int getGlyphWidth(int c) { return rend->g.getGlyphWidth(c); } |
float getGlyphWidth(int c) { return rend->g.getGlyphWidth(c); } |
43 |
}; |
}; |
44 |
|
|
45 |
typedef std::vector<GLubyte> ByteVector; |
typedef std::vector<GLubyte> ByteVector; |
671 |
} |
} |
672 |
|
|
673 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_putFontWidths |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_putFontWidths |
674 |
(JNIEnv *env, jclass, jint fontId, jshortArray widths) { |
(JNIEnv *env, jclass, jint fontId, jfloatArray widths) { |
675 |
|
|
676 |
int arrayLength = env->GetArrayLength(widths); |
int arrayLength = env->GetArrayLength(widths); |
677 |
jshort *w = env->GetShortArrayElements(widths, 0); |
jfloat *w = env->GetFloatArrayElements(widths, 0); |
678 |
RealFont *font = fonts.get(fontId); |
RealFont *font = fonts.get(fontId); |
679 |
|
|
680 |
for(int i=0; i<arrayLength; i++) { |
for(int i=0; i<arrayLength; i++) { |
681 |
w[i] = font->getGlyphWidth(i); |
w[i] = font->getGlyphWidth(i); |
682 |
} |
} |
683 |
|
|
684 |
env->ReleaseShortArrayElements(widths, w, 0); |
env->ReleaseFloatArrayElements(widths, w, 0); |
685 |
} |
} |
686 |
|
|
687 |
|
|