void
shape (std::vector<unsigned long> &string, const std::vector<unsigned long> &text);
-int eTextPara::renderString(const std::string &string, int rflags)
+int eTextPara::renderString(const char *string, int rflags)
{
singleLock s(ftlock);
}
std::vector<unsigned long> uc_string, uc_visual;
- uc_string.reserve(string.length());
+ if (string)
+ uc_string.reserve(strlen(string));
- std::string::const_iterator p(string.begin());
+ const char *p = string;
- while(p != string.end())
+ while(p)
{
unsigned int unicode=(unsigned char)*p++;
{
unicode&=0x1F;
unicode<<=6;
- if (p != string.end())
+ if (p)
unicode|=(*p++)&0x3F;
} else if ((unicode & 0xF0)==0xE0) // three bytes
{
unicode&=0x0F;
unicode<<=6;
- if (p != string.end())
+ if (p)
unicode|=(*p++)&0x3F;
unicode<<=6;
- if (p != string.end())
+ if (p)
unicode|=(*p++)&0x3F;
} else if ((unicode & 0xF8)==0xF0) // four bytes
{
unicode&=0x07;
unicode<<=6;
- if (p != string.end())
+ if (p)
unicode|=(*p++)&0x3F;
unicode<<=6;
- if (p != string.end())
+ if (p)
unicode|=(*p++)&0x3F;
unicode<<=6;
- if (p != string.end())
+ if (p)
unicode|=(*p++)&0x3F;
}
}
static void forceReplacementGlyph(int unicode) { forced_replaces.insert(unicode); }
void setFont(const gFont *font);
- int renderString(const std::string &string, int flags=0);
+ int renderString(const char *string, int flags=0);
void clear();
o.dc = m_dc.grabRef();
o.parm.renderText = new gOpcode::para::prenderText;
o.parm.renderText->area = pos;
- o.parm.renderText->text = string;
+ o.parm.renderText->text = string.empty()?0:strdup(string.c_str());
o.parm.renderText->flags = flags;
m_rc->submit(o);
}
assert(m_current_font);
para->setFont(m_current_font);
para->renderString(o->parm.renderText->text, (flags & gPainter::RT_WRAP) ? RS_WRAP : 0);
-
+ if (o->parm.renderText->text)
+ free(o->parm.renderText->text);
if (flags & gPainter::RT_HALIGN_RIGHT)
para->realign(eTextPara::dirRight);
else if (flags & gPainter::RT_HALIGN_CENTER)
struct prenderText
{
eRect area;
- std::string text;
+ char *text;
int flags;
} *renderText;
eDebug("cursor is %d", cursor);
para->setFont(m_font);
- para->renderString(text, 0);
+ para->renderString(text.empty()?0:text.c_str(), 0);
int glyphs = para->size();
if (m_have_focus)
style->setStyle(painter, eWindowStyle::styleLabel);
ePtr<eTextPara> para = new eTextPara(eRect(0, 0, size().width(), size().height()));
para->setFont(m_font);
- para->renderString(m_text, 0);
+ para->renderString(m_text.empty()?0:m_text.c_str(), 0);
para->realign(eTextPara::dirLeft);
int glyphs = para->size();
ePtr<eTextPara> p = new eTextPara(eRect(0, 0, size().width(), size().height()));
p->setFont(m_font);
- p->renderString(m_text, RS_WRAP);
+ p->renderString(m_text.empty()?0:m_text.c_str(), RS_WRAP);
eRect bbox = p->getBoundBox();
return bbox.size();
eTextPara *para = new eTextPara(tmp);
para->setFont(m_element_font[e]);
- para->renderString(text);
+ para->renderString(text.c_str());
if (e == celServiceName)
{