mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-02 20:42:29 +01:00
Drawing now takes the style and scale too, like measuring, so the text drawers have no font state left. UIContext keeps its current style and passes it, and fills it in from the theme if nothing has set one yet. PPGe passes its one font. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "ppsspp_config.h"
|
|
|
|
#include <map>
|
|
#include "Common/Render/Text/draw_text.h"
|
|
|
|
#if PPSSPP_PLATFORM(ANDROID)
|
|
|
|
#include <jni.h>
|
|
|
|
struct AndroidFontEntry {
|
|
int font;
|
|
float size;
|
|
};
|
|
|
|
class TextDrawerAndroid : public TextDrawer {
|
|
public:
|
|
TextDrawerAndroid(Draw::DrawContext *draw);
|
|
~TextDrawerAndroid();
|
|
|
|
bool IsReady() const override;
|
|
|
|
protected:
|
|
void EnsureFont(const FontStyle &style) override;
|
|
void MeasureStringInternal(const FontStyle &style, std::string_view str, float *w, float *h) override;
|
|
bool DrawStringBitmap(const FontStyle &style, std::vector<uint8_t> &bitmapData, TextStringEntry &entry, Draw::DataFormat texFormat, std::string_view str, int align, bool fullColor) override;
|
|
bool SupportsColorEmoji() const override { return true; }
|
|
|
|
void ClearFonts() override;
|
|
|
|
private:
|
|
// JNI functions
|
|
jclass cls_textRenderer = nullptr;
|
|
jmethodID method_allocFont = nullptr;
|
|
jmethodID method_freeAllFonts = nullptr;
|
|
jmethodID method_measureText = nullptr;
|
|
jmethodID method_renderText = nullptr;
|
|
|
|
std::map<FontStyle, AndroidFontEntry> fontMap_;
|
|
std::map<std::string, int> allocatedFonts_;
|
|
};
|
|
|
|
#endif
|