vcl/win/gdi/salfont.cxx | 68 ------------------------------------------------ 1 file changed, 68 deletions(-)
New commits: commit 8815ae462f32915209c838688b7cc86f57e280d4 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Oct 11 15:47:49 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Oct 11 22:59:58 2022 +0200 loplugin:unreffun ...after the last use of that RawFontData got removed in 112d07027c4484dd571519911596d11eae897524 "vcl: Use PhysicalFontFace::GetRawFontData() for font embedding" Change-Id: Id85eb39b6fd946da132d53ba937032f3c58b061d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141225 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 9d618c6b9c81..75080dae4261 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -85,74 +85,6 @@ static int IntTimes256FromFixed(FIXED f) return nFixedTimes256; } -namespace { - -// raw font data with a scoped lifetime -class RawFontData -{ -public: - explicit RawFontData( HDC, DWORD nTableTag=0 ); - const unsigned char* get() const { return mpRawBytes.get(); } - const unsigned char* steal() { return mpRawBytes.release(); } - int size() const { return mnByteCount; } - -private: - std::unique_ptr<unsigned char[]> mpRawBytes; - unsigned mnByteCount; -}; - -} - -RawFontData::RawFontData( HDC hDC, DWORD nTableTag ) -: mnByteCount( 0 ) -{ - // get required size in bytes - mnByteCount = ::GetFontData( hDC, nTableTag, 0, nullptr, 0 ); - if (mnByteCount == GDI_ERROR) - mnByteCount = 0; - if (!mnByteCount) - return; - - // allocate the array - mpRawBytes.reset(new unsigned char[ mnByteCount ]); - - // get raw data in chunks small enough for GetFontData() - unsigned nRawDataOfs = 0; - DWORD nMaxChunkSize = 0x100000; - for(;;) - { - // calculate remaining raw data to get - DWORD nFDGet = mnByteCount - nRawDataOfs; - if( nFDGet <= 0 ) - break; - // #i56745# limit GetFontData requests - if( nFDGet > nMaxChunkSize ) - nFDGet = nMaxChunkSize; - const DWORD nFDGot = ::GetFontData( hDC, nTableTag, nRawDataOfs, - mpRawBytes.get() + nRawDataOfs, nFDGet ); - if( !nFDGot ) - break; - else if( nFDGot != GDI_ERROR ) - nRawDataOfs += nFDGot; - else - { - // was the chunk too big? reduce it - nMaxChunkSize /= 2; - if( nMaxChunkSize < 0x10000 ) - break; - } - } - - // cleanup if the raw data is incomplete - if( nRawDataOfs != mnByteCount ) - { - mpRawBytes.reset(); - // mnByteCount must correspond to mpRawBytes length - SAL_WARN( "vcl", "Raw data of font is incomplete: " << nRawDataOfs << " byte(s) found whereas " << mnByteCount << " byte(s) expected!" ); - mnByteCount = 0; - } -} - // platform specific font substitution hooks for glyph fallback enhancement namespace {