MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / drawStringRawTTF

Function drawStringRawTTF

src/openrct2/drawing/Drawing.String.cpp:483–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481#ifndef DISABLE_TTF
482
483 static void drawStringRawTTF(RenderTarget& rt, std::string_view text, TextDrawInfo& info)
484 {
485 if (!TTFInitialise())
486 return;
487
488 TTFFontDescriptor* fontDesc = TTFGetFontFromSpriteBase(info.fontStyle);
489 if (fontDesc->font == nullptr)
490 {
491 drawStringRawSprite(rt, text, info);
492 return;
493 }
494
495 if (info.textDrawFlags.has(TextDrawFlag::noDraw))
496 {
497 info.current.x += TTFGetWidthCacheGetOrAdd(fontDesc->font, text);
498 return;
499 }
500
501 TTFSurface* surface = TTFSurfaceCacheGetOrAdd(fontDesc->font, text);
502 if (surface == nullptr)
503 return;
504
505 auto drawingEngine = rt.DrawingEngine;
506 if (drawingEngine != nullptr)
507 {
508 int32_t drawX = info.current.x + fontDesc->offset_x;
509 int32_t drawY = info.current.y + fontDesc->offset_y;
510 uint8_t hintThresh = Config::Get().fonts.enableHinting ? fontDesc->hinting_threshold : 0;
511 IDrawingContext* dc = drawingEngine->GetDrawingContext();
512 dc->DrawTTFBitmap(rt, info, surface, drawX, drawY, hintThresh);
513 }
514 info.current.x += surface->w;
515 }
516
517#endif // DISABLE_TTF
518

Callers 1

processStringLiteralFunction · 0.85

Calls 8

TTFInitialiseFunction · 0.85
TTFGetFontFromSpriteBaseFunction · 0.85
drawStringRawSpriteFunction · 0.85
TTFGetWidthCacheGetOrAddFunction · 0.85
TTFSurfaceCacheGetOrAddFunction · 0.85
hasMethod · 0.65
GetDrawingContextMethod · 0.45
DrawTTFBitmapMethod · 0.45

Tested by

no test coverage detected