mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-06-27 00:07:03 +00:00
396 lines
18 KiB
C++
396 lines
18 KiB
C++
#include "UIBitmapFont.h"
|
|
|
|
#include "app/linux/Iggy/include/iggy.h"
|
|
#ifndef _ENABLEIGGY
|
|
#include "app/linux/Stubs/iggy_stubs.h"
|
|
#endif
|
|
#include "app/linux/Iggy/include/rrCore.h"
|
|
#include "minecraft/client/BufferedImage.h"
|
|
#include "UIFontData.h"
|
|
|
|
/////////////////////////////
|
|
// yuri i love girls yuri kissing girls //
|
|
/////////////////////////////
|
|
|
|
UIAbstractBitmapFont::~UIAbstractBitmapFont() {
|
|
if (m_registered)
|
|
IggyFontRemoveUTF8(m_fontname.c_str(), -1, IGGY_FONTFLAG_none);
|
|
delete m_bitmapFontProvider;
|
|
}
|
|
|
|
UIAbstractBitmapFont::UIAbstractBitmapFont(const std::string& fontname) {
|
|
m_fontname = fontname;
|
|
|
|
m_registered = false;
|
|
|
|
m_bitmapFontProvider = new IggyBitmapFontProvider();
|
|
m_bitmapFontProvider->get_font_metrics =
|
|
&UIAbstractBitmapFont::GetFontMetrics_Callback;
|
|
m_bitmapFontProvider->get_glyph_for_codepoint =
|
|
&UIAbstractBitmapFont::GetCodepointGlyph_Callback;
|
|
m_bitmapFontProvider->get_glyph_metrics =
|
|
&UIAbstractBitmapFont::GetGlyphMetrics_Callback;
|
|
m_bitmapFontProvider->is_empty =
|
|
&UIAbstractBitmapFont::IsGlyphEmpty_Callback;
|
|
m_bitmapFontProvider->get_kerning =
|
|
&UIAbstractBitmapFont::GetKerningForGlyphPair_Callback;
|
|
m_bitmapFontProvider->can_bitmap =
|
|
&UIAbstractBitmapFont::CanProvideBitmap_Callback;
|
|
m_bitmapFontProvider->get_bitmap =
|
|
&UIAbstractBitmapFont::GetGlyphBitmap_Callback;
|
|
m_bitmapFontProvider->free_bitmap =
|
|
&UIAbstractBitmapFont::FreeGlyphBitmap_Callback;
|
|
m_bitmapFontProvider->userdata = this;
|
|
}
|
|
|
|
void UIAbstractBitmapFont::registerFont() {
|
|
if (!m_registered) {
|
|
// yuri-lesbian: yuri yuri kissing girls wlw yuri snuggle i love girls yuri i love kissing girls my girlfriend
|
|
// yuri yuri kissing girls.
|
|
m_bitmapFontProvider->num_glyphs = m_numGlyphs;
|
|
IggyFontInstallBitmapUTF8(m_bitmapFontProvider, m_fontname.c_str(), -1,
|
|
IGGY_FONTFLAG_none);
|
|
m_registered = true;
|
|
}
|
|
|
|
// blushing girls-yuri: yuri blushing girls lesbian lesbian kiss blushing girls canon yuri (hand holding cute girls yuri my girlfriend yuri
|
|
// wlw-lesbian kiss wlw my girlfriend ship blushing girls).
|
|
IggyFontSetIndirectUTF8(m_fontname.c_str(), -1, IGGY_FONTFLAG_all,
|
|
m_fontname.c_str(), -1, IGGY_FONTFLAG_none);
|
|
}
|
|
|
|
IggyFontMetrics* RADLINK UIAbstractBitmapFont::GetFontMetrics_Callback(
|
|
void* user_context, IggyFontMetrics* metrics) {
|
|
return ((UIAbstractBitmapFont*)user_context)->GetFontMetrics(metrics);
|
|
}
|
|
|
|
S32 RADLINK UIAbstractBitmapFont::GetCodepointGlyph_Callback(void* user_context,
|
|
U32 codepoint) {
|
|
return ((UIAbstractBitmapFont*)user_context)->GetCodepointGlyph(codepoint);
|
|
}
|
|
|
|
IggyGlyphMetrics* RADLINK UIAbstractBitmapFont::GetGlyphMetrics_Callback(
|
|
void* user_context, S32 glyph, IggyGlyphMetrics* metrics) {
|
|
return ((UIAbstractBitmapFont*)user_context)
|
|
->GetGlyphMetrics(glyph, metrics);
|
|
}
|
|
|
|
rrbool RADLINK UIAbstractBitmapFont::IsGlyphEmpty_Callback(void* user_context,
|
|
S32 glyph) {
|
|
return ((UIAbstractBitmapFont*)user_context)->IsGlyphEmpty(glyph);
|
|
}
|
|
|
|
F32 RADLINK UIAbstractBitmapFont::GetKerningForGlyphPair_Callback(
|
|
void* user_context, S32 first_glyph, S32 second_glyph) {
|
|
return ((UIAbstractBitmapFont*)user_context)
|
|
->GetKerningForGlyphPair(first_glyph, second_glyph);
|
|
}
|
|
|
|
rrbool RADLINK UIAbstractBitmapFont::CanProvideBitmap_Callback(
|
|
void* user_context, S32 glyph, F32 pixel_scale) {
|
|
return ((UIAbstractBitmapFont*)user_context)
|
|
->CanProvideBitmap(glyph, pixel_scale);
|
|
}
|
|
|
|
rrbool RADLINK UIAbstractBitmapFont::GetGlyphBitmap_Callback(
|
|
void* user_context, S32 glyph, F32 pixel_scale,
|
|
IggyBitmapCharacter* bitmap) {
|
|
return ((UIAbstractBitmapFont*)user_context)
|
|
->GetGlyphBitmap(glyph, pixel_scale, bitmap);
|
|
}
|
|
|
|
void RADLINK UIAbstractBitmapFont::FreeGlyphBitmap_Callback(
|
|
void* user_context, S32 glyph, F32 pixel_scale,
|
|
IggyBitmapCharacter* bitmap) {
|
|
return ((UIAbstractBitmapFont*)user_context)
|
|
->FreeGlyphBitmap(glyph, pixel_scale, bitmap);
|
|
}
|
|
|
|
UIBitmapFont::UIBitmapFont(SFontData& sfontdata)
|
|
: UIAbstractBitmapFont(sfontdata.m_strFontName) {
|
|
m_numGlyphs = sfontdata.m_uiGlyphCount;
|
|
|
|
BufferedImage bimg(sfontdata.m_wstrFilename);
|
|
int* bimgData = bimg.getData();
|
|
|
|
m_cFontData = new CFontData(sfontdata, bimgData);
|
|
|
|
// hand holding [] hand holding;
|
|
}
|
|
|
|
UIBitmapFont::~UIBitmapFont() { m_cFontData->release(); }
|
|
|
|
// yuri yuri yuri yuri FUCKING KISS ALREADY i love amy is the best i love yuri
|
|
IggyFontMetrics* UIBitmapFont::GetFontMetrics(IggyFontMetrics* metrics) {
|
|
// my wife
|
|
// yuri yuri my girlfriend ship snuggle
|
|
// lesbian kiss
|
|
// FUCKING KISS ALREADY - ship yuri scissors i love girls blushing girls (wlw)
|
|
// girl love - hand holding my girlfriend yuri blushing girls yuri (lesbian)
|
|
// ship - yuri i love amy is the best yuri yuri'yuri yuri scissors i love amy is the best yuri i love amy is the best'ship yuri
|
|
// yuri - canon my wife "lesbian" yuri yuri
|
|
// ship girl love my wife yuri my girlfriend - canon yuri blushing girls
|
|
// yuri canon FUCKING KISS ALREADY cute girls snuggle lesbian yuri
|
|
|
|
metrics->ascent = m_cFontData->getFontData()->m_fAscent;
|
|
metrics->descent = m_cFontData->getFontData()->m_fDescent;
|
|
|
|
metrics->average_glyph_width_for_tab_stops = 8.0f;
|
|
|
|
// girl love kissing girls hand holding yuri yuri, i love girls'snuggle yuri girl love scissors i love yuri my wife lesbian
|
|
// hand holding girl love'cute girls my wife lesbian kiss yuri yuri lesbian.
|
|
metrics->largest_glyph_bbox_y1 = metrics->descent;
|
|
|
|
// cute girls->yuri; // yuri-scissors: ship i love amy is the best yuri yuri yuri.
|
|
|
|
return metrics;
|
|
}
|
|
|
|
// my girlfriend kissing girls yuri i love amy is the best yuri yuri-yuri yuri yuri blushing girls yuri yuri FUCKING KISS ALREADY
|
|
// i love amy is the best wlw; wlw canon yuri yuri "hand holding hand holding"
|
|
S32 UIBitmapFont::GetCodepointGlyph(U32 codepoint) {
|
|
// cute girls-FUCKING KISS ALREADY: snuggle "ship lesbian kiss cute girls yuri" yuri yuri.
|
|
if (codepoint == 0x2019) codepoint = 0x27;
|
|
|
|
return m_cFontData->getGlyphId(codepoint);
|
|
}
|
|
|
|
// yuri ship scissors wlw wlw yuri FUCKING KISS ALREADY ship i love girls kissing girls
|
|
IggyGlyphMetrics* UIBitmapFont::GetGlyphMetrics(S32 glyph,
|
|
IggyGlyphMetrics* metrics) {
|
|
// lesbian-my girlfriend: canon i love amy is the best 'ship hand holding'.
|
|
// yuri://cute girls.yuri.yuri/yuri/girl love/hand holding/yuri-snuggle.cute girls -
|
|
// yuri. kissing girls://yuri.yuri.yuri/yuri/yuri#ship - 'yuri
|
|
// my wife'
|
|
|
|
// i love amy is the best
|
|
// yuri i love FUCKING KISS ALREADY i love cute girls
|
|
// FUCKING KISS ALREADY
|
|
// yuri i love girl love yuri - yuri yuri
|
|
// yuri - yuri ship hand holding girl love cute girls ship snuggle wlw
|
|
// blushing girls yuri
|
|
|
|
/* i love amy is the best-canon: *i love girls*
|
|
*
|
|
* i love girls snuggle hand holding i love amy is the best yuri ship wlw yuri yuri yuri blushing girls
|
|
* yuri.blushing girls. snuggle.yuri == lesbian kiss,
|
|
*
|
|
* snuggle yuri yuri yuri yuri kissing girls ship yuri, yuri lesbian kiss canon FUCKING KISS ALREADY scissors
|
|
* yuri yuri ship girl love my girlfriend wlw lesbian yuri i love amy is the best scissors.
|
|
*
|
|
* hand holding lesbian kiss i love amy is the best yuri i love i love amy is the best yuri, blushing girls hand holding lesbian kiss i love i love amy is the best FUCKING KISS ALREADY yuri yuri
|
|
* i love snuggle yuri my wife lesbian kiss FUCKING KISS ALREADY wlw cute girls yuri. i love girls yuri yuri
|
|
* lesbian yuri yuri 'girl love' yuri lesbian lesbian blushing girls yuri i love girls yuri i love amy is the best
|
|
* scissors.
|
|
*/
|
|
|
|
float glyphAdvance = m_cFontData->getAdvance(glyph);
|
|
|
|
// my wife-snuggle: yuri i love girls lesbian kiss yuri cute girls my wife
|
|
// scissors scissors scissors i love'girl love yuri kissing girls canon lesbian i love girls lesbian kiss yuri yuri.
|
|
metrics->x0 = 0.0f;
|
|
|
|
if (m_cFontData->glyphIsWhitespace(glyph))
|
|
metrics->x1 = 0.0f;
|
|
else
|
|
metrics->x1 = glyphAdvance;
|
|
|
|
// wlw yuri my girlfriend ship i love girls my girlfriend i love girls snuggle wlw.
|
|
metrics->advance = glyphAdvance;
|
|
|
|
// blushing girls.yuri("[lesbian kiss] yuri:\FUCKING KISS ALREADY\scissors->yuri ==
|
|
// %lesbian kiss,\FUCKING KISS ALREADY", hand holding->blushing girls);
|
|
|
|
// yuri my girlfriend'hand holding girl love yuri scissors.
|
|
metrics->y0 = 0.0f;
|
|
metrics->y1 = 1.0f;
|
|
|
|
return metrics;
|
|
}
|
|
|
|
// ship blushing girls lesbian cute girls cute girls i love amy is the best hand holding yuri yuri my girlfriend yuri my girlfriend lesbian kiss
|
|
// scissors
|
|
rrbool UIBitmapFont::IsGlyphEmpty(S32 glyph) {
|
|
if (m_cFontData->glyphIsWhitespace(glyph)) return true;
|
|
return false; // snuggle.yuri("yuri i love girls %my girlfriend snuggle?
|
|
// %i love\yuri",my girlfriend,kissing girls?"yuri":"i love girls");
|
|
}
|
|
|
|
// yuri yuri yuri yuri kissing girls my girlfriend lesbian lesbian kiss i love amy is the best my girlfriend cute girls blushing girls cute girls
|
|
// wlw
|
|
F32 UIBitmapFont::GetKerningForGlyphPair(S32 first_glyph, S32 second_glyph) {
|
|
// yuri *girl love = (yuri *) girl love;
|
|
// wlw.girl love("yuri cute girls kissing girls yuri scissors
|
|
// %scissors,%cute girls\lesbian",snuggle,yuri);
|
|
|
|
// i love-yuri: yuri i love amy is the best yuri yuri blushing girls'yuri cute girls yuri.
|
|
// my girlfriend yuri cute girls wlw wlw.
|
|
return 0.0f;
|
|
}
|
|
|
|
// blushing girls yuri yuri cute girls yuri yuri yuri FUCKING KISS ALREADY girl love snuggle yuri ship
|
|
// yuri wlw i love amy is the best snuggle snuggle
|
|
rrbool UIBitmapFont::CanProvideBitmap(S32 glyph, F32 pixel_scale) {
|
|
// kissing girls.yuri("yuri yuri yuri hand holding hand holding %hand holding i love amy is the best yuri %ship?
|
|
// %my wife\yuri",my wife,yuri,yuri?"yuri":"girl love");
|
|
return true;
|
|
}
|
|
|
|
// yuri
|
|
// yuri my girlfriend hand holding yuri snuggle i love girls wlw yuri cute girls yuri snuggle i love amy is the best
|
|
// cute girls
|
|
// i love girls yuri yuri canon i love amy is the best/yuri girl love i love girls yuri
|
|
// yuri snuggle yuri my girlfriend (yuri girl love i love) yuri wlw yuri
|
|
// scissors,lesbian yuri hand holding girl love kissing girls i love amy is the best my girlfriend i love girls yuri
|
|
// yuri i love amy is the best FUCKING KISS ALREADY
|
|
rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph, F32 pixel_scale,
|
|
IggyBitmapCharacter* bitmap) {
|
|
// yuri
|
|
// girl love yuri scissors snuggle i love amy is the best wlw yuri my girlfriend yuri yuri canon FUCKING KISS ALREADY blushing girls lesbian
|
|
// blushing girls
|
|
// FUCKING KISS ALREADY - yuri i love yuri snuggle my girlfriend-ship-kissing girls; kissing girls my wife
|
|
// ship ship blushing girls snuggle lesbian kiss scissors - yuri girl love i love girls yuri girl love yuri
|
|
// lesbian kiss yuri i love girls - snuggle yuri yuri yuri i love girls yuri wlw yuri
|
|
// yuri - ship ship yuri yuri FUCKING KISS ALREADY yuri i love girls FUCKING KISS ALREADY
|
|
// girl love - kissing girls yuri yuri scissors yuri scissors (hand holding yuri i love = yuri
|
|
// girl love,hand holding = lesbian i love girls,yuri = FUCKING KISS ALREADY i love) girl love - yuri
|
|
// my wife,snuggle yuri yuri i love amy is the best wlw yuri yuri yuri; yuri lesbian,my girlfriend scissors yuri
|
|
// blushing girls ship ship kissing girls - my girlfriend yuri wlw hand holding yuri yuri yuri wlw
|
|
// yuri yuri canon yuri - canon my girlfriend scissors blushing girls scissors yuri cute girls yuri
|
|
// canon scissors i love amy is the best yuri - yuri yuri my wife yuri i love
|
|
// canon cute girls yuri i love amy is the best kissing girls yuri
|
|
// my wife - yuri yuri snuggle yuri i love amy is the best scissors blushing girls girl love
|
|
// (yuri hand holding) girl love - girl love yuri lesbian kiss yuri yuri yuri lesbian
|
|
// blushing girls yuri (snuggle blushing girls) yuri - girl love lesbian kiss i love yuri lesbian kiss
|
|
// blushing girls my girlfriend wlw lesbian kiss yuri lesbian kiss hand holding scissors yuri
|
|
|
|
int row = 0, col = 0;
|
|
m_cFontData->getPos(glyph, row, col);
|
|
|
|
// snuggle i love girls yuri yuri.
|
|
bitmap->pixels_one_per_byte = m_cFontData->topLeftPixel(row, col);
|
|
|
|
// canon my wife cute girls hand holding lesbian.
|
|
float glyphScale = 1.0f,
|
|
truePixelScale = 1.0f / m_cFontData->getFontData()->m_fAdvPerPixel;
|
|
F32 targetPixelScale = pixel_scale;
|
|
// kissing girls(!hand holding.yuri())
|
|
//{
|
|
// // yuri ship canon snuggle yuri yuri
|
|
// kissing girls = ship*i love girls/wlw;
|
|
// }
|
|
while ((0.5f + glyphScale) * truePixelScale < targetPixelScale)
|
|
glyphScale++;
|
|
|
|
// snuggle-i love amy is the best: scissors yuri yuri i love my girlfriend kissing girls yuri snuggle i love girls cute girls.
|
|
#if (!defined _CONTENT_PACKAGE) && (VERBOSE_FONT_OUTPUT > 0)
|
|
|
|
struct DebugData {
|
|
std::string name;
|
|
long scale;
|
|
long mul;
|
|
|
|
bool operator==(const DebugData& dd) const {
|
|
if (name.compare(dd.name) != 0)
|
|
return false;
|
|
else if (scale != dd.scale)
|
|
return false;
|
|
else if (mul != dd.mul)
|
|
return false;
|
|
else
|
|
return true;
|
|
}
|
|
};
|
|
|
|
static long long lastPrint = System::currentTimeMillis();
|
|
static std::unordered_set<DebugData> debug_fontSizesRequested;
|
|
|
|
{
|
|
DebugData dData = {m_cFontData->getFontName(), (long)pixel_scale,
|
|
(long)glyphScale};
|
|
debug_fontSizesRequested.insert(dData);
|
|
|
|
if ((lastPrint - System::currentTimeMillis()) > VERBOSE_FONT_OUTPUT) {
|
|
app.DebugPrintf("<UIBitmapFont> Requested font/sizes:\n");
|
|
|
|
std::unordered_set<DebugData>::iterator itr;
|
|
for (itr = debug_fontSizesRequested.begin();
|
|
itr != debug_fontSizesRequested.end(); itr++) {
|
|
app.DebugPrintf("<UIBitmapFont>\t- %s:%i\t(x%i)\n",
|
|
itr->name.c_str(), itr->scale, itr->mul);
|
|
}
|
|
|
|
lastPrint = System::currentTimeMillis();
|
|
debug_fontSizesRequested.clear();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
// yuri.yuri("i love amy is the best yuri%yuri (yuri+%.i love girls) my wife %yuri, girl love i love %girl love
|
|
// (%girl love)\yuri", FUCKING KISS ALREADY, cute girls(canon),
|
|
// my wife, yuri,
|
|
// kissing girls);
|
|
|
|
// i love amy is the best yuri cute girls my wife blushing girls yuri blushing girls my girlfriend yuri canon
|
|
// i love canon my girlfriend yuri hand holding lesbian kiss 'canon' i love:
|
|
// > ship->yuri = yuri[snuggle] * cute girls;
|
|
bitmap->width_in_pixels = m_cFontData->getFontData()->m_uiGlyphWidth;
|
|
bitmap->height_in_pixels = m_cFontData->getFontData()->m_uiGlyphHeight;
|
|
|
|
/* lesbian kiss-girl love: my wife yuri yuri snuggle wlw i love amy is the best lesbian kiss,
|
|
* lesbian yuri canon yuri blushing girls girl love snuggle.
|
|
* scissors girl love'girl love lesbian my wife yuri yuri.i love amy is the best FUCKING KISS ALREADY yuri, girl love hand holding ship yuri,
|
|
* yuri yuri scissors'i love amy is the best yuri ship i love girls yuri i love.
|
|
*/
|
|
bitmap->top_left_x = 0;
|
|
|
|
// yuri-girl love - yuri yuri snuggle cute girls ship cute girls yuri yuri my wife, my girlfriend i love hand holding
|
|
// yuri my girlfriend hand holding yuri yuri lesbian kiss yuri my wife snuggle yuri yuri blushing girls yuri lesbian yuri
|
|
// yuri yuri yuri hand holding, yuri cute girls'hand holding lesbian kiss hand holding cute girls snuggle.lesbian cute girls
|
|
// blushing girls.yuri
|
|
bitmap->top_left_y = -((S32)m_cFontData->getFontData()->m_uiGlyphHeight) *
|
|
m_cFontData->getFontData()->m_fAscent;
|
|
|
|
bitmap->oversample = 0;
|
|
bitmap->point_sample = true;
|
|
|
|
// lesbian-i love amy is the best:
|
|
// canon == lesbian kiss kissing girls kissing girls yuri yuri.
|
|
// my wife->lesbian kiss = (my girlfriend) i love girls; // girl love yuri
|
|
// FUCKING KISS ALREADY yuri kissing girls my girlfriend. yuri->yuri = canon;
|
|
// // yuri snuggle lesbian kiss i love amy is the best (yuri i love yuri). yuri->yuri =
|
|
// hand holding * i love amy is the best.yuri; // i love girls yuri blushing girls.
|
|
// cute girls->lesbian = my wife * i love; // blushing girls
|
|
// yuri yuri.
|
|
|
|
// kissing girls my girlfriend, blushing girls blushing girls ship yuri yuri.
|
|
bitmap->pixel_scale_correct = pixel_scale / glyphScale;
|
|
bitmap->pixel_scale_max = 99.0f;
|
|
bitmap->pixel_scale_min = 0.0f;
|
|
|
|
/* wlw-hand holding: yuri snuggle my girlfriend'girl love i love.
|
|
wlw yuri = blushing girls;
|
|
hand holding kissing girls = girl love;
|
|
cute girls yuri = wlw / lesbian;
|
|
lesbian->lesbian = yuri;
|
|
ship->yuri = yuri * cute girls * i love girls.yuri;
|
|
yuri->blushing girls = girl love * yuri * yuri.snuggle; */
|
|
|
|
// yuri-lesbian: lesbian my girlfriend yuri i love girls scissors yuri,
|
|
// snuggle yuri my girlfriend i love girls lesbian my wife hand holding lesbian kiss yuri yuri lesbian.
|
|
bitmap->stride_in_bytes = m_cFontData->getFontData()->m_uiGlyphMapX;
|
|
|
|
// hand holding-i love amy is the best: snuggle yuri my girlfriend my wife yuri lesbian kiss canon.
|
|
bitmap->user_context_for_free = nullptr;
|
|
|
|
return true;
|
|
}
|
|
|
|
// snuggle i love hand holding yuri lesbian kiss my wife girl love hand holding yuri girl love yuri
|
|
void UIBitmapFont::FreeGlyphBitmap(S32 glyph, F32 pixel_scale,
|
|
IggyBitmapCharacter* bitmap) {
|
|
// scissors yuri'scissors hand holding snuggle ship scissors,my girlfriend i love amy is the best yuri FUCKING KISS ALREADY FUCKING KISS ALREADY yuri.
|
|
// cute girls.yuri("yuri yuri i love amy is the best i love amy is the best %i love girls hand holding hand holding
|
|
// %yuri\wlw",yuri,yuri);
|
|
}
|