hopefully final fix for missing iconv
This commit is contained in:
parent
622af75c92
commit
6a098b0797
1 changed files with 9 additions and 5 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
//$Id: Font.cc,v 1.16 2004/08/31 21:24:05 fluxgen Exp $
|
//$Id: Font.cc,v 1.17 2004/08/31 21:47:56 akir Exp $
|
||||||
|
|
||||||
|
|
||||||
#include "StringUtil.hh"
|
#include "StringUtil.hh"
|
||||||
|
@ -279,8 +279,8 @@ Font::Font(const char *name, bool antialias):
|
||||||
// drawing functions
|
// drawing functions
|
||||||
m_utf8mode = true;
|
m_utf8mode = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif // HAVE_ICONV
|
#endif // HAVE_ICONV
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
cerr<<"FbTk::Font m_iconv = "<<(int)m_iconv<<endl;
|
cerr<<"FbTk::Font m_iconv = "<<(int)m_iconv<<endl;
|
||||||
|
@ -311,8 +311,10 @@ Font::Font(const char *name, bool antialias):
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::~Font() {
|
Font::~Font() {
|
||||||
|
#ifdef HAVE_ICONV
|
||||||
if (m_iconv != (iconv_t)(-1))
|
if (m_iconv != (iconv_t)(-1))
|
||||||
iconv_close(m_iconv);
|
iconv_close(m_iconv);
|
||||||
|
#endif // HAVE_ICONV
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::setAntialias(bool flag) {
|
void Font::setAntialias(bool flag) {
|
||||||
|
@ -390,6 +392,7 @@ bool Font::load(const std::string &name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Font::textWidth(const char * const text, unsigned int size) const {
|
unsigned int Font::textWidth(const char * const text, unsigned int size) const {
|
||||||
|
#ifdef HAVE_ICONV
|
||||||
if (m_iconv != (iconv_t)(-1)) {
|
if (m_iconv != (iconv_t)(-1)) {
|
||||||
char* rtext = recode(m_iconv, text, size);
|
char* rtext = recode(m_iconv, text, size);
|
||||||
if (rtext != 0)
|
if (rtext != 0)
|
||||||
|
@ -399,7 +402,7 @@ unsigned int Font::textWidth(const char * const text, unsigned int size) const {
|
||||||
delete rtext;
|
delete rtext;
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
#endif // HAVE_ICONV
|
||||||
return m_fontimp->textWidth(text, size);
|
return m_fontimp->textWidth(text, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +429,7 @@ void Font::drawText(Drawable w, int screen, GC gc,
|
||||||
// so we don't end up in a loop with m_shadow
|
// so we don't end up in a loop with m_shadow
|
||||||
static bool first_run = true;
|
static bool first_run = true;
|
||||||
|
|
||||||
|
#ifdef HAVE_ICONV
|
||||||
if (m_iconv != (iconv_t)(-1) && first_run) {
|
if (m_iconv != (iconv_t)(-1) && first_run) {
|
||||||
rtext = recode(m_iconv, text, len);
|
rtext = recode(m_iconv, text, len);
|
||||||
if (rtext != 0) {
|
if (rtext != 0) {
|
||||||
|
@ -433,7 +437,7 @@ void Font::drawText(Drawable w, int screen, GC gc,
|
||||||
// ok, we can't use utf8 mode since the string is invalid
|
// ok, we can't use utf8 mode since the string is invalid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // HAVE_ICONV
|
||||||
|
|
||||||
const char *real_text = rtext ? rtext : text;
|
const char *real_text = rtext ? rtext : text;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue