2010-10-14 01:27:31 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2007-04-11 11:58:09 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 01:39:30 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-04-11 11:58:09 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-04-11 11:58:09 -05:00
|
|
|
*
|
2008-04-11 01:39:30 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-04-11 11:58:09 -05:00
|
|
|
*
|
2008-04-11 01:39:30 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-04-11 11:58:09 -05:00
|
|
|
*
|
2008-04-11 01:39:30 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-04-11 11:58:09 -05:00
|
|
|
*
|
2008-04-11 01:39:30 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-04-11 11:58:09 -05:00
|
|
|
*
|
2008-04-11 01:39:30 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-04-11 11:58:09 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _SV_IMPFONT_HXX
|
|
|
|
#define _SV_IMPFONT_HXX
|
|
|
|
|
|
|
|
#include <tools/gen.hxx>
|
|
|
|
#include <tools/string.hxx>
|
|
|
|
#include <i18npool/lang.h>
|
|
|
|
#include <tools/color.hxx>
|
|
|
|
#include <vcl/dllapi.h>
|
|
|
|
#include <vcl/vclenum.hxx>
|
|
|
|
#include <vcl/fntstyle.hxx>
|
|
|
|
|
|
|
|
// ------------
|
|
|
|
// - Impl_Font -
|
|
|
|
// ------------
|
|
|
|
|
|
|
|
class Impl_Font
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Impl_Font();
|
|
|
|
Impl_Font( const Impl_Font& );
|
|
|
|
|
|
|
|
bool operator==( const Impl_Font& ) const;
|
|
|
|
|
|
|
|
FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; }
|
|
|
|
FontFamily GetFamily() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; }
|
|
|
|
FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; }
|
|
|
|
FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; }
|
|
|
|
FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW)AskConfig(); return meWidthType; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class Font;
|
|
|
|
void AskConfig();
|
|
|
|
|
|
|
|
int mnRefCount;
|
|
|
|
String maFamilyName;
|
|
|
|
String maStyleName;
|
|
|
|
Size maSize;
|
|
|
|
Color maColor; // compatibility, now on output device
|
|
|
|
Color maFillColor; // compatibility, now on output device
|
|
|
|
rtl_TextEncoding meCharSet;
|
|
|
|
LanguageType meLanguage;
|
|
|
|
LanguageType meCJKLanguage;
|
|
|
|
FontFamily meFamily;
|
|
|
|
FontPitch mePitch;
|
|
|
|
TextAlign meAlign;
|
|
|
|
FontWeight meWeight;
|
|
|
|
FontWidth meWidthType;
|
|
|
|
FontItalic meItalic;
|
|
|
|
FontUnderline meUnderline;
|
2009-01-05 11:49:45 -06:00
|
|
|
FontUnderline meOverline;
|
2007-04-11 11:58:09 -05:00
|
|
|
FontStrikeout meStrikeout;
|
|
|
|
FontRelief meRelief;
|
|
|
|
FontEmphasisMark meEmphasisMark;
|
|
|
|
FontType meType; // used by metrics only
|
|
|
|
short mnOrientation;
|
|
|
|
FontKerning mnKerning;
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_Bool mbWordLine:1,
|
2007-04-11 11:58:09 -05:00
|
|
|
mbOutline:1,
|
|
|
|
mbConfigLookup:1, // there was a config lookup
|
|
|
|
mbShadow:1,
|
|
|
|
mbVertical:1,
|
|
|
|
mbTransparent:1; // compatibility, now on output device
|
|
|
|
|
|
|
|
friend SvStream& operator>>( SvStream& rIStm, Impl_Font& );
|
|
|
|
friend SvStream& operator<<( SvStream& rOStm, const Impl_Font& );
|
|
|
|
};
|
|
|
|
|
|
|
|
// ------------------
|
|
|
|
// - ImplFontMetric -
|
|
|
|
// ------------------
|
|
|
|
|
|
|
|
class ImplFontMetric
|
|
|
|
{
|
|
|
|
friend class OutputDevice;
|
|
|
|
|
|
|
|
private:
|
|
|
|
long mnAscent; // Ascent
|
|
|
|
long mnDescent; // Descent
|
|
|
|
long mnIntLeading; // Internal Leading
|
|
|
|
long mnExtLeading; // External Leading
|
|
|
|
long mnLineHeight; // Ascent+Descent+EmphasisMark
|
|
|
|
long mnSlant; // Slant
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uInt16 mnMiscFlags; // Misc Flags
|
|
|
|
sal_uInt32 mnRefCount; // Reference Counter
|
2007-04-11 11:58:09 -05:00
|
|
|
|
|
|
|
enum { DEVICE_FLAG=1, SCALABLE_FLAG=2, LATIN_FLAG=4, CJK_FLAG=8, CTL_FLAG=16 };
|
|
|
|
|
|
|
|
public:
|
|
|
|
ImplFontMetric();
|
|
|
|
void AddReference();
|
|
|
|
void DeReference();
|
|
|
|
|
|
|
|
long GetAscent() const { return mnAscent; }
|
|
|
|
long GetDescent() const { return mnDescent; }
|
|
|
|
long GetIntLeading() const { return mnIntLeading; }
|
|
|
|
long GetExtLeading() const { return mnExtLeading; }
|
|
|
|
long GetLineHeight() const { return mnLineHeight; }
|
|
|
|
long GetSlant() const { return mnSlant; }
|
|
|
|
|
|
|
|
bool IsDeviceFont() const { return ((mnMiscFlags & DEVICE_FLAG) != 0); }
|
|
|
|
bool IsScalable() const { return ((mnMiscFlags & SCALABLE_FLAG) != 0); }
|
|
|
|
bool SupportsLatin() const { return ((mnMiscFlags & LATIN_FLAG) != 0); }
|
|
|
|
bool SupportsCJK() const { return ((mnMiscFlags & CJK_FLAG) != 0); }
|
|
|
|
bool SupportsCTL() const { return ((mnMiscFlags & CTL_FLAG) != 0); }
|
|
|
|
|
|
|
|
bool operator==( const ImplFontMetric& ) const;
|
|
|
|
};
|
|
|
|
|
2009-12-23 05:24:41 -06:00
|
|
|
// ------------------
|
2011-03-10 09:59:44 -06:00
|
|
|
// - ImplFontOptions -
|
2009-12-23 05:24:41 -06:00
|
|
|
// ------------------
|
|
|
|
|
2010-02-12 05:55:46 -06:00
|
|
|
class ImplFontOptions
|
2009-12-23 05:24:41 -06:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
FontEmbeddedBitmap meEmbeddedBitmap; // whether the embedded bitmaps should be used
|
|
|
|
FontAntiAlias meAntiAlias; // whether the font should be antialiased
|
|
|
|
FontAutoHint meAutoHint; // whether the font should be autohinted
|
|
|
|
FontHinting meHinting; // whether the font should be hinted
|
|
|
|
FontHintStyle meHintStyle; // type of font hinting to be used
|
|
|
|
public:
|
2010-02-12 05:55:46 -06:00
|
|
|
ImplFontOptions() :
|
2009-12-23 05:24:41 -06:00
|
|
|
meEmbeddedBitmap(EMBEDDEDBITMAP_DONTKNOW),
|
|
|
|
meAntiAlias(ANTIALIAS_DONTKNOW),
|
|
|
|
meAutoHint(AUTOHINT_DONTKNOW),
|
|
|
|
meHinting(HINTING_DONTKNOW),
|
|
|
|
meHintStyle(HINT_SLIGHT)
|
|
|
|
{}
|
2011-03-10 09:59:44 -06:00
|
|
|
virtual ~ImplFontOptions()
|
2009-12-23 05:24:41 -06:00
|
|
|
{}
|
2011-03-10 09:59:44 -06:00
|
|
|
FontAutoHint GetUseAutoHint() const
|
|
|
|
{ return meAutoHint; }
|
|
|
|
FontHintStyle GetHintStyle() const
|
|
|
|
{ return meHintStyle; }
|
|
|
|
bool DontUseEmbeddedBitmaps() const
|
|
|
|
{ return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; }
|
|
|
|
bool DontUseAntiAlias() const
|
|
|
|
{ return meAntiAlias == ANTIALIAS_FALSE; }
|
|
|
|
bool DontUseHinting() const
|
|
|
|
{ return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); }
|
2011-03-18 11:20:38 -05:00
|
|
|
virtual void *GetPattern(void * /*pFace*/, bool /*bEmbolden*/) const
|
2011-03-16 10:47:14 -05:00
|
|
|
{ return NULL; }
|
2009-12-23 05:24:41 -06:00
|
|
|
};
|
|
|
|
|
2007-04-11 11:58:09 -05:00
|
|
|
// -------------------
|
|
|
|
// - ImplFontCharMap -
|
|
|
|
// -------------------
|
|
|
|
|
2009-08-27 07:02:29 -05:00
|
|
|
class CmapResult;
|
|
|
|
|
2010-12-08 06:53:30 -06:00
|
|
|
class VCL_PLUGIN_PUBLIC ImplFontCharMap
|
2007-04-11 11:58:09 -05:00
|
|
|
{
|
|
|
|
public:
|
2010-04-20 08:53:33 -05:00
|
|
|
explicit ImplFontCharMap( const CmapResult& );
|
|
|
|
virtual ~ImplFontCharMap();
|
2009-08-27 07:02:29 -05:00
|
|
|
|
|
|
|
static ImplFontCharMap* GetDefaultMap( bool bSymbols=false);
|
2007-04-11 11:58:09 -05:00
|
|
|
|
|
|
|
bool IsDefaultMap() const;
|
|
|
|
bool HasChar( sal_uInt32 ) const;
|
|
|
|
int CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const;
|
|
|
|
int GetCharCount() const;
|
|
|
|
|
|
|
|
sal_uInt32 GetFirstChar() const;
|
|
|
|
sal_uInt32 GetLastChar() const;
|
|
|
|
|
|
|
|
sal_uInt32 GetNextChar( sal_uInt32 ) const;
|
|
|
|
sal_uInt32 GetPrevChar( sal_uInt32 ) const;
|
|
|
|
|
|
|
|
int GetIndexFromChar( sal_uInt32 ) const;
|
|
|
|
sal_uInt32 GetCharFromIndex( int ) const;
|
|
|
|
|
2010-08-17 08:22:46 -05:00
|
|
|
void AddReference() const;
|
|
|
|
void DeReference() const;
|
2007-04-11 11:58:09 -05:00
|
|
|
|
2009-08-27 07:02:29 -05:00
|
|
|
int GetGlyphIndex( sal_uInt32 ) const;
|
2007-04-11 11:58:09 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
int ImplFindRangeIndex( sal_uInt32 ) const;
|
|
|
|
|
|
|
|
// prevent assignment and copy construction
|
2009-08-27 07:02:29 -05:00
|
|
|
explicit ImplFontCharMap( const ImplFontCharMap& );
|
2007-04-11 11:58:09 -05:00
|
|
|
void operator=( const ImplFontCharMap& );
|
|
|
|
|
|
|
|
private:
|
|
|
|
const sal_uInt32* mpRangeCodes; // pairs of StartCode/(EndCode+1)
|
2009-08-27 07:02:29 -05:00
|
|
|
const int* mpStartGlyphs; // range-specific mapper to glyphs
|
2010-09-29 02:46:40 -05:00
|
|
|
const sal_uInt16* mpGlyphIds; // individual glyphid mappings
|
2007-04-11 11:58:09 -05:00
|
|
|
int mnRangeCount;
|
2010-08-17 08:22:46 -05:00
|
|
|
int mnCharCount; // covered codepoints
|
|
|
|
mutable int mnRefCount;
|
2007-04-11 11:58:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// CmapResult is a normalized version of the many CMAP formats
|
2010-12-08 06:53:30 -06:00
|
|
|
class VCL_PLUGIN_PUBLIC CmapResult
|
2007-04-11 11:58:09 -05:00
|
|
|
{
|
2009-08-27 07:02:29 -05:00
|
|
|
public:
|
|
|
|
explicit CmapResult( bool bSymbolic = false,
|
|
|
|
const sal_uInt32* pRangeCodes = NULL, int nRangeCount = 0,
|
2010-09-29 02:46:40 -05:00
|
|
|
const int* pStartGlyphs = 0, const sal_uInt16* pGlyphIds = NULL );
|
2009-08-27 07:02:29 -05:00
|
|
|
|
|
|
|
const sal_uInt32* mpRangeCodes;
|
|
|
|
const int* mpStartGlyphs;
|
2010-09-29 02:46:40 -05:00
|
|
|
const sal_uInt16* mpGlyphIds;
|
2009-08-27 07:02:29 -05:00
|
|
|
int mnRangeCount;
|
|
|
|
bool mbSymbolic;
|
|
|
|
bool mbRecoded;
|
2007-04-11 11:58:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
bool ParseCMAP( const unsigned char* pRawData, int nRawLength, CmapResult& );
|
|
|
|
|
|
|
|
#endif // _SV_IMPFONT_HXX
|
2009-08-27 07:02:29 -05:00
|
|
|
|
2010-10-14 01:27:31 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|