diff options
author | Herbert Duerr [hdu] <duerr@sun.com> | 2010-04-12 17:16:41 +0200 |
---|---|---|
committer | Herbert Duerr [hdu] <duerr@sun.com> | 2010-04-12 17:16:41 +0200 |
commit | dbe5e2a03511da7dcd3399fe31c40d6ac5e96326 (patch) | |
tree | b5531ab7b2bf9bb9b630debadbb15e5604af6381 /vcl/source/fontsubset | |
parent | 38f4d323100037df1c2cb89087781a7677d44278 (diff) |
#i110387# use strhelper\'s implementation for dbl2str
Diffstat (limited to 'vcl/source/fontsubset')
-rw-r--r-- | vcl/source/fontsubset/cff.cxx | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 9d329755baeb..620ca64f44d9 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -33,6 +33,7 @@ #include <assert.h> #include <vcl/fontsubset.hxx> +#include <vcl/strhelper.hxx> //#define IGNORE_HINTS @@ -2030,28 +2031,9 @@ void Type1Emitter::emitAllCrypted( void) // #i110387# quick-and-dirty double->ascii conversion // needed because sprintf/ecvt/etc. alone are too localized (LC_NUMERIC) // also strip off trailing zeros in fraction while we are at it -int dbl2str( char* pOut, double fVal, int nPrecision=6) +inline int dbl2str( char* pOut, double fVal, int nPrecision=6) { - char* pBuf = pOut; - // TODO: avoid LC_NUMERIC based API - pOut += sprintf( pOut, "%.*g", nPrecision, fVal); - // ignore the number sign if any - char* p = pBuf; - if( (*p == '-') || (*p == '+')) - ++p; - for(; p < pOut; ++p) { - if( (*p >= '0') || (*p <= '9')) - continue; - // fixup fractional char - *(p++) = '.'; - break; - } - // ignore trailing zeros in fractional part - for( char* pEnd = pOut; p < pEnd; ++p) - if( *p != '0') - pOut = p; - // calculate the length of the number string - const int nLen = pOut - pBuf; + const int nLen = psp::getValueOfDouble( pOut, fVal, nPrecision); return nLen; } |