Finish removing QDState

This commit is contained in:
elasota
2020-05-21 05:01:16 -04:00
parent 432cdbcc3a
commit 5869571747
35 changed files with 253 additions and 407 deletions

View File

@@ -7,6 +7,7 @@
#include "PLPasStr.h"
#include "Externs.h"
#include "RenderedFont.h"
#include <string.h>
@@ -275,17 +276,17 @@ void GetFirstWordOfString (StringPtr stringIn, StringPtr stringOut)
// font. If the text would exceed our width limit, characters<72>
// are dropped off the end of the string and "<22>" appended.
void CollapseStringToWidth (DrawSurface *surface, StringPtr theStr, short wide)
void CollapseStringToWidth (PortabilityLayer::RenderedFont *font, StringPtr theStr, short wide)
{
short dotsWide;
Boolean tooWide;
dotsWide = surface->MeasureString(PSTR("<EFBFBD>"));
tooWide = surface->MeasureString(theStr) > wide;
while (tooWide)
dotsWide = font->MeasurePStr(PSTR("<EFBFBD>"));
tooWide = font->MeasurePStr(theStr) > wide;
while (tooWide && theStr[0] > 0)
{
theStr[0]--;
tooWide = ((surface->MeasureString(theStr) + dotsWide) > wide);
tooWide = ((font->MeasurePStr(theStr) + dotsWide) > wide);
if (!tooWide)
PasStringConcat(theStr, PSTR("<EFBFBD>"));
}