vcl: add text alignment functions to ImplFont and FontAttributes

ImplFont and FontAttributes now have GetAlignment and SetAlignment,
and I have renamed Font::GetAlign to Font::GetAlignment, and
Font::SetAlign to Font::SetAlignment.

See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor
and mutator for font scaling in FontMetric") for reasoning behind
patch.

Unit test added to vcl/qa/cppunit/font.cxx to test text alignment.

Change-Id: I6272c84fc9416c90616d957d1897eba9469fe7ba
Reviewed-on: https://gerrit.libreoffice.org/21876
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
This commit is contained in:
Chris Sherlock 2016-01-28 16:31:30 +11:00
parent 6402164182
commit d1a49df683
57 changed files with 115 additions and 93 deletions

View File

@ -103,7 +103,7 @@ void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage,
vcl::Font aFont( aOldFont );
aFont.SetWeight( WEIGHT_BOLD );
aFont.SetAlign( ALIGN_BOTTOM );
aFont.SetAlignment( ALIGN_BOTTOM );
pPrinter->SetFont( aFont );
long nFontHeight = pPrinter->GetTextHeight();
@ -802,7 +802,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
vcl::Font aOldFont( pPrinter->GetFont() );
vcl::Font aFont( GetEditEngine()->GetFont() );
aFont.SetAlign( ALIGN_BOTTOM );
aFont.SetAlignment( ALIGN_BOTTOM );
aFont.SetTransparent( true );
aFont.SetSize( Size( 0, 360 ) );
pPrinter->SetFont( aFont );

View File

@ -1117,7 +1117,7 @@ void lcl_PrintHeader( Printer* pPrinter, const OUString& rTitle ) // not working
vcl::Font aFont( pPrinter->GetFont() );
aFont.SetWeight( WEIGHT_BOLD );
aFont.SetAlign( ALIGN_BOTTOM );
aFont.SetAlignment( ALIGN_BOTTOM );
pPrinter->SetFont( aFont );
long const nFontHeight = pPrinter->GetTextHeight();
@ -1160,7 +1160,7 @@ void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not wor
MapMode aMap( MAP_100TH_MM );
pPrinter->SetMapMode( aMap );
vcl::Font aFont;
aFont.SetAlign( ALIGN_BOTTOM );
aFont.SetAlignment( ALIGN_BOTTOM );
aFont.SetSize( Size( 0, 360 ));
pPrinter->SetFont( aFont );

View File

@ -45,7 +45,7 @@ namespace cairocanvas
maFontRequest( rFontRequest ),
mpRefDevice( rDevice )
{
maFont->SetAlign( ALIGN_BASELINE );
maFont->SetAlignment( ALIGN_BASELINE );
maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
maFont->SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES );

View File

@ -112,7 +112,7 @@ namespace dxcanvas
rFontRequest.FontDescription.StyleName,
Size( 0, ::basegfx::fround(rFontRequest.CellSize)));
aFont.SetAlign( ALIGN_BASELINE );
aFont.SetAlignment( ALIGN_BASELINE );
aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==css::util::TriState_YES) ? sal_True : sal_False );
aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );
@ -247,7 +247,7 @@ namespace dxcanvas
rFontRequest.FontDescription.StyleName,
Size( 0, ::basegfx::fround(rFontRequest.CellSize)));
aFont.SetAlign( ALIGN_BASELINE );
aFont.SetAlignment( ALIGN_BASELINE );
aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
aFont.SetVertical( (rFontRequest.FontDescription.IsVertical==css::util::TriState_YES) ? sal_True : sal_False );
aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );

View File

@ -729,7 +729,7 @@ namespace oglcanvas
rFontRequest.FontDescription.StyleName,
Size( 0, ::basegfx::fround(rFontRequest.CellSize)));
aFont.SetAlign( ALIGN_BASELINE );
aFont.SetAlignment( ALIGN_BASELINE );
aFont.SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
aFont.SetVertical( rFontRequest.FontDescription.IsVertical==util::TriState_YES );
aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) );

View File

@ -47,7 +47,7 @@ namespace vclcanvas
mpRefDevice( &rDevice ),
mpOutDevProvider( rOutDevProvider )
{
maFont->SetAlign( ALIGN_BASELINE );
maFont->SetAlignment( ALIGN_BASELINE );
maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE );
maFont->SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES );

View File

@ -275,7 +275,7 @@ void SvxShowText::SetFont( const vcl::Font& rFont )
long nWinHeight = GetOutputSizePixel().Height();
maFont = vcl::Font(rFont);
maFont.SetWeight(WEIGHT_NORMAL);
maFont.SetAlign(ALIGN_TOP);
maFont.SetAlignment(ALIGN_TOP);
maFont.SetSize(PixelToLogic(Size(0, nWinHeight / 2)));
maFont.SetTransparent(true);
Control::SetFont(maFont);

View File

@ -663,7 +663,7 @@ void SplashScreenWindow::Paint(vcl::RenderContext& rRenderContext, const Rectang
_vdev->DrawRect(Rectangle(pSpl->_tlx+pSpl->_barspace, pSpl->_tly+pSpl->_barspace, pSpl->_tlx+pSpl->_barspace+length, pSpl->_tly+pSpl->_barheight-pSpl->_barspace));
vcl::Font aFont;
aFont.SetSize(Size(0, 12));
aFont.SetAlign(ALIGN_BASELINE);
aFont.SetAlignment(ALIGN_BASELINE);
_vdev->SetFont(aFont);
_vdev->SetTextColor(pSpl->_cProgressTextColor);
_vdev->DrawText(Point(pSpl->_tlx, pSpl->_textBaseline), pSpl->_sProgressText);

View File

@ -301,10 +301,10 @@ namespace
}
if(!(nPushFlags & PushFlags::TEXTALIGN ))
{
if(pLast->getFont().GetAlign() != pTip->getFont().GetAlign())
if(pLast->getFont().GetAlignment() != pTip->getFont().GetAlignment())
{
vcl::Font aFont(pLast->getFont());
aFont.SetAlign(pTip->getFont().GetAlign());
aFont.SetAlignment(pTip->getFont().GetAlignment());
pLast->setFont(aFont);
}
}
@ -1237,12 +1237,12 @@ namespace
rTextTransform.scale(aFontScaling.getX(), aFontScaling.getY());
// take text align into account
if(ALIGN_BASELINE != rFont.GetAlign())
if(ALIGN_BASELINE != rFont.GetAlignment())
{
drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice;
aTextLayouterDevice.setFont(rFont);
if(ALIGN_TOP == rFont.GetAlign())
if(ALIGN_TOP == rFont.GetAlignment())
{
rAlignmentOffset.setY(aTextLayouterDevice.getFontAscent());
}
@ -2659,10 +2659,10 @@ namespace
// TextAlign is applied to the current font (as in
// OutputDevice::SetTextAlign which would be used when
// playing the Metafile)
if(rPropertyHolders.Current().getFont().GetAlign() != aNewTextAlign)
if(rPropertyHolders.Current().getFont().GetAlignment() != aNewTextAlign)
{
vcl::Font aNewFont(rPropertyHolders.Current().getFont());
aNewFont.SetAlign(aNewTextAlign);
aNewFont.SetAlignment(aNewTextAlign);
rPropertyHolders.Current().setFont(aNewFont);
}

View File

@ -400,7 +400,7 @@ namespace drawinglayer
Size(bFontIsScaled ? std::max<sal_uInt32>(nWidth, 1) : 0, nHeight));
#endif
// define various other FontAttribute
aRetval.SetAlign(ALIGN_BASELINE);
aRetval.SetAlignment(ALIGN_BASELINE);
aRetval.SetCharSet(rFontAttribute.getSymbol() ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE);
aRetval.SetVertical(rFontAttribute.getVertical());
aRetval.SetWeight(static_cast<FontWeight>(rFontAttribute.getWeight()));

View File

@ -2023,7 +2023,7 @@ void EditDoc::RemoveItemsFromPool(const ContentNode& rNode)
void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, SvtScriptType nScriptType )
{
vcl::Font aPrevFont( rFont );
rFont.SetAlign( ALIGN_BASELINE );
rFont.SetAlignment( ALIGN_BASELINE );
rFont.SetTransparent( true );
sal_uInt16 nWhich_FontInfo = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType );

View File

@ -44,7 +44,7 @@ void SvxBulletItem::StoreFont( SvStream& rStream, const vcl::Font& rFont )
rStream.WriteUInt16( nTemp );
nTemp = (sal_uInt16)rFont.GetPitch(); rStream.WriteUInt16( nTemp );
nTemp = (sal_uInt16)rFont.GetAlign(); rStream.WriteUInt16( nTemp );
nTemp = (sal_uInt16)rFont.GetAlignment(); rStream.WriteUInt16( nTemp );
nTemp = (sal_uInt16)rFont.GetWeight(); rStream.WriteUInt16( nTemp );
nTemp = (sal_uInt16)rFont.GetUnderline(); rStream.WriteUInt16( nTemp );
nTemp = (sal_uInt16)rFont.GetStrikeout(); rStream.WriteUInt16( nTemp );
@ -73,7 +73,7 @@ vcl::Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer )
aFont.SetCharSet((rtl_TextEncoding)nTemp);
rStream.ReadUInt16( nTemp ); aFont.SetPitch((FontPitch)nTemp);
rStream.ReadUInt16( nTemp ); aFont.SetAlign((FontAlign)nTemp);
rStream.ReadUInt16( nTemp ); aFont.SetAlignment((FontAlign)nTemp);
rStream.ReadUInt16( nTemp ); aFont.SetWeight((FontWeight)nTemp);
rStream.ReadUInt16( nTemp ); aFont.SetUnderline((FontUnderline)nTemp);
rStream.ReadUInt16( nTemp ); aFont.SetStrikeout((FontStrikeout)nTemp);
@ -202,7 +202,7 @@ SfxPoolItem* SvxBulletItem::Create( SvStream& rStrm, sal_uInt16 /*nVersion*/ ) c
void SvxBulletItem::SetDefaultFont_Impl()
{
aFont = OutputDevice::GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_SYSTEM, GetDefaultFontFlags::NONE );
aFont.SetAlign( ALIGN_BOTTOM);
aFont.SetAlignment( ALIGN_BOTTOM);
aFont.SetTransparent( true );
}

View File

@ -893,7 +893,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
nScaledLineHeight *= nScale*10;
nScaledLineHeight /= 1000;
aBulletFont.SetAlign( ALIGN_BOTTOM );
aBulletFont.SetAlignment( ALIGN_BOTTOM );
aBulletFont.SetSize( Size( 0, nScaledLineHeight ) );
bool bVertical = IsVertical();
aBulletFont.SetVertical( bVertical );
@ -946,7 +946,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
vcl::Font aBulletFont( ImpCalcBulletFont( nPara ) );
// Use baseline
bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
aBulletFont.SetAlign( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE );
aBulletFont.SetAlignment( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE );
vcl::Font aOldFont = pOutDev->GetFont();
pOutDev->SetFont( aBulletFont );

View File

@ -567,7 +567,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
FlashFont& rFlashFont = Impl_getFont( aFont );
// always adjust text position to match baseline alignment
switch( aOldFont.GetAlign() )
switch( aOldFont.GetAlignment() )
{
case( ALIGN_TOP ):
aBaseLinePos.Y() += aMetric.GetAscent();

View File

@ -454,7 +454,7 @@ sal_uInt16 FlashFont::getGlyph( sal_uInt16 nChar, VirtualDevice* pVDev )
vcl::Font aOldFont( pVDev->GetFont() );
vcl::Font aNewFont( aOldFont );
aNewFont.SetAlign( ALIGN_BASELINE );
aNewFont.SetAlignment( ALIGN_BASELINE );
pVDev->SetFont( aNewFont );
aOldFont.SetOrientation(0);

View File

@ -203,7 +203,7 @@ bool DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short nAngle,
aFont.SetTransparent(true);
aFont.SetFamily(FAMILY_SWISS);
aFont.SetSize(Size(0,nHeight));
aFont.SetAlign(ALIGN_BASELINE);
aFont.SetAlignment(ALIGN_BASELINE);
aFont.SetOrientation(nAngle);
if (aActFont!=aFont) {
aActFont=aFont;

View File

@ -2264,7 +2264,7 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
pF->pSucc=pFontList; pFontList=pF;
pF->nID=0;
pF->aFont.SetTransparent(true);
pF->aFont.SetAlign(ALIGN_BASELINE);
pF->aFont.SetAlignment(ALIGN_BASELINE);
nPos=pOS2MET->Tell();
nMaxPos=nPos+(sal_uLong)nFieldSize;

View File

@ -1874,7 +1874,7 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile )
aActFont.SetCharSet( GetTextEncoding());
aActFont.SetFamily(FAMILY_SWISS);
aActFont.SetSize(Size(0,12));
aActFont.SetAlign(ALIGN_BASELINE);
aActFont.SetAlignment(ALIGN_BASELINE);
aHRes = aVRes = Fraction( 1, 1 );

View File

@ -1056,7 +1056,7 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
aFont.SetItalic( ITALIC_NONE );
aFont.SetWidthType( WIDTH_NORMAL );
aFont.SetWeight( WEIGHT_NORMAL );
aFont.SetAlign( ALIGN_BOTTOM );
aFont.SetAlignment( ALIGN_BOTTOM );
long nTextWidth = rPageSize.Width();
if( rPageSize.Width() < rPageSize.Height() )
{

View File

@ -196,7 +196,7 @@ void SVGFontExport::implEmbedFont( const vcl::Font& rFont )
vcl::Font aFont( rFont );
aFont.SetSize( Size( 0, nFontEM ) );
aFont.SetAlign( ALIGN_BASELINE );
aFont.SetAlignment( ALIGN_BASELINE );
pVDev->SetMapMode( MAP_100TH_MM );
pVDev->SetFont( aFont );

View File

@ -1555,9 +1555,9 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
const FontMetric aMetric( mpVDev->GetFontMetric() );
const vcl::Font& rFont = mpVDev->GetFont();
if( rFont.GetAlign() == ALIGN_TOP )
if( rFont.GetAlignment() == ALIGN_TOP )
aBaseLinePos.Y() += aMetric.GetAscent();
else if( rFont.GetAlign() == ALIGN_BOTTOM )
else if( rFont.GetAlignment() == ALIGN_BOTTOM )
aBaseLinePos.Y() -= aMetric.GetDescent();
if( bApplyMapping )
@ -2435,9 +2435,9 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
const FontMetric aMetric( mpVDev->GetFontMetric() );
const vcl::Font& rFont = mpVDev->GetFont();
if( rFont.GetAlign() == ALIGN_TOP )
if( rFont.GetAlignment() == ALIGN_TOP )
aBaseLinePos.Y() += aMetric.GetAscent();
else if( rFont.GetAlign() == ALIGN_BOTTOM )
else if( rFont.GetAlignment() == ALIGN_BOTTOM )
aBaseLinePos.Y() -= aMetric.GetDescent();
if( bApplyMapping )

View File

@ -64,8 +64,8 @@ public:
FontPitch GetPitch() const;
FontWidth GetWidthType();
FontWidth GetWidthType() const;
FontAlign GetAlignment() const;
rtl_TextEncoding GetCharSet() const;
FontAlign GetAlign() const;
bool IsSymbolFont() const;
@ -77,8 +77,8 @@ public:
void SetItalic( FontItalic );
void SetWeight( FontWeight );
void SetWidthType( FontWidth );
void SetAlignment( FontAlign );
void SetCharSet( rtl_TextEncoding );
void SetAlign( FontAlign );
void SetSymbolFlag( bool );

View File

@ -1171,7 +1171,7 @@ public:
bool IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); }
void SetTextAlign( TextAlign eAlign );
TextAlign GetTextAlign() const { return maFont.GetAlign(); }
TextAlign GetTextAlign() const { return maFont.GetAlignment(); }
/** Width of the text.

View File

@ -111,7 +111,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const Rectangle& rInnerP
vcl::Font aAppFont = pDev->GetSettings().GetStyleSettings().GetAppFont();
aAppFont.SetSize( aAttrFont.GetSize() );
aAppFont.SetAlign( ALIGN_TOP );
aAppFont.SetAlignment( ALIGN_TOP );
pDev->SetFont( aAppFont );
Size aTextSize( pDev->GetTextWidth( rTitle ), pDev->GetTextHeight() );

View File

@ -323,7 +323,7 @@ void ScDrawStringsVars::SetPattern(
else
pPattern->GetFont( aFont, eColorMode, pFmtDevice, &pOutput->aZoomY, pCondSet, nScript,
&aBackConfigColor, &aTextConfigColor );
aFont.SetAlign(ALIGN_BASELINE);
aFont.SetAlignment(ALIGN_BASELINE);
// orientation

View File

@ -155,7 +155,7 @@ RehearseTimingsActivity::RehearseTimingsActivity( const SlideShowContext& rConte
{
maFont.SetHeight( maFont.GetHeight() * 2 );
maFont.SetWidth( maFont.GetWidth() * 2 );
maFont.SetAlign( ALIGN_BASELINE );
maFont.SetAlignment( ALIGN_BASELINE );
maFont.SetColor( COL_BLACK );
// determine sprite size (in pixel):

View File

@ -267,7 +267,7 @@ void SmShowFont::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRec
vcl::Font aFont(maFont);
aFont.SetSize(Size(0, 24 * rRenderContext.GetDPIScaleFactor()));
aFont.SetAlign(ALIGN_TOP);
aFont.SetAlignment(ALIGN_TOP);
rRenderContext.SetFont(aFont);
rRenderContext.SetTextColor(aTextColor);
@ -1148,7 +1148,7 @@ void SmShowSymbolSetWindow::Paint(vcl::RenderContext& rRenderContext, const Rect
{
SmSym aSymbol(*aSymbolSet[i]);
vcl::Font aFont(aSymbol.GetFace());
aFont.SetAlign(ALIGN_TOP);
aFont.SetAlignment(ALIGN_TOP);
// taking a FontSize which is a bit smaller (compared to nLen) in order to have a buffer
// (hopefully enough for left and right, too)
@ -1423,7 +1423,7 @@ void SmShowSymbol::SetSymbol(const SmSym *pSymbol)
{
vcl::Font aFont (pSymbol->GetFace());
setFontSize(aFont);
aFont.SetAlign(ALIGN_BASELINE);
aFont.SetAlignment(ALIGN_BASELINE);
SetFont(aFont);
sal_UCS4 cChar = pSymbol->GetCharacter();
@ -1688,7 +1688,7 @@ void SmShowChar::SetSymbol( sal_UCS4 cChar, const vcl::Font &rFont )
{
vcl::Font aFont( rFont );
aFont.SetSize( Size(0, GetOutputSize().Height() - GetOutputSize().Height() / 3) );
aFont.SetAlign(ALIGN_BASELINE);
aFont.SetAlignment(ALIGN_BASELINE);
SetFont(aFont);
aFont.SetTransparent(true);

View File

@ -158,7 +158,7 @@ SmFormat::SmFormat()
{
SmFace &rFace = vFont[i];
rFace.SetTransparent( true );
rFace.SetAlign( ALIGN_BASELINE );
rFace.SetAlignment( ALIGN_BASELINE );
rFace.SetColor( COL_AUTO );
bDefaultFont[i] = false;
}
@ -169,7 +169,7 @@ void SmFormat::SetFont(sal_uInt16 nIdent, const SmFace &rFont, bool bDefault )
{
vFont[nIdent] = rFont;
vFont[nIdent].SetTransparent( true );
vFont[nIdent].SetAlign( ALIGN_BASELINE );
vFont[nIdent].SetAlignment( ALIGN_BASELINE );
bDefaultFont[nIdent] = bDefault;
}

View File

@ -615,7 +615,7 @@ bool SmGetGlyphBoundRect(const vcl::RenderContext &rDev,
pGlyphDev->Push(PushFlags::FONT | PushFlags::MAPMODE);
vcl::Font aFnt(rDev.GetFont());
aFnt.SetAlign(ALIGN_TOP);
aFnt.SetAlignment(ALIGN_TOP);
// use scale factor when calling GetTextBoundRect to counter
// negative effects from antialiasing which may otherwise result

View File

@ -52,7 +52,7 @@ SmSym::SmSym() :
{
m_aExportName = m_aName;
m_aFace.SetTransparent(true);
m_aFace.SetAlign(ALIGN_BASELINE);
m_aFace.SetAlignment(ALIGN_BASELINE);
}
@ -69,7 +69,7 @@ SmSym::SmSym(const OUString& rName, const vcl::Font& rFont, sal_UCS4 cChar,
m_aFace = rFont;
m_aFace.SetTransparent(true);
m_aFace.SetAlign(ALIGN_BASELINE);
m_aFace.SetAlignment(ALIGN_BASELINE);
m_cChar = cChar;
m_aSetName = rSet;

View File

@ -460,7 +460,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
SmFace aSet( sFontName, rOld.GetSize() );
aSet.SetBorderWidth( rOld.GetBorderWidth() );
aSet.SetAlign( ALIGN_BASELINE );
aSet.SetAlignment( ALIGN_BASELINE );
aFormat.SetFont( (*ppEntries)->mnMemberId, aSet );
}
}

View File

@ -235,7 +235,7 @@ void SmFace::Impl_Init()
{
SetSize( GetSize() );
SetTransparent( true );
SetAlign( ALIGN_BASELINE );
SetAlignment( ALIGN_BASELINE );
SetColor( COL_AUTO );
}

View File

@ -1148,7 +1148,7 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri
Size aSize650 (0, 650);
vcl::Font aFont(FAMILY_DONTKNOW, aSize600);
aFont.SetAlign(ALIGN_TOP);
aFont.SetAlignment(ALIGN_TOP);
aFont.SetWeight(WEIGHT_BOLD);
aFont.SetSize(aSize650);
aFont.SetColor( Color(COL_BLACK) );
@ -1192,7 +1192,7 @@ void SmViewShell::Impl_Print(OutputDevice &rOutDev, const SmPrintUIOptions &rPri
if (bIsPrintFormulaText)
{
vcl::Font aFont(FAMILY_DONTKNOW, Size(0, 600));
aFont.SetAlign(ALIGN_TOP);
aFont.SetAlignment(ALIGN_TOP);
aFont.SetColor( Color(COL_BLACK) );
// get size

View File

@ -527,7 +527,7 @@ void SmDrawingVisitor::DrawSpecialNode( SmSpecialNode* pNode )
{
//! since this chars might come from any font, that we may not have
//! set to ALIGN_BASELINE yet, we do it now.
pNode->GetFont( ).SetAlign( ALIGN_BASELINE );
pNode->GetFont( ).SetAlignment( ALIGN_BASELINE );
DrawTextNode( pNode );
}

View File

@ -159,7 +159,7 @@ void CalculateHorizontalScalingFactor( const SdrObject* pCustomShape,
vcl::Font aFont;
const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(pCustomShape->GetMergedItem( EE_CHAR_FONTINFO ));
aFont.SetHeight( pCustomShape->GetLogicRect().GetHeight() / rFWData.nMaxParagraphsPerTextArea );
aFont.SetAlign( ALIGN_TOP );
aFont.SetAlignment( ALIGN_TOP );
aFont.SetFamilyName( rFontItem.GetFamilyName() );
aFont.SetFamily( rFontItem.GetFamily() );
aFont.SetStyleName( rFontItem.GetStyleName() );
@ -246,7 +246,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(pCustomShape->GetMergedItem( nFntItm ));
vcl::Font aFont;
aFont.SetHeight( rFWData.nSingleLineHeight );
aFont.SetAlign( ALIGN_TOP );
aFont.SetAlignment( ALIGN_TOP );
aFont.SetFamilyName( rFontItem.GetFamilyName() );
aFont.SetFamily( rFontItem.GetFamily() );

View File

@ -523,7 +523,7 @@ void SvxShowCharSet::InitSettings(vcl::RenderContext& rRenderContext)
vcl::Font aFont(rRenderContext.GetFont());
aFont.SetWeight(WEIGHT_LIGHT);
aFont.SetAlign(ALIGN_TOP);
aFont.SetAlignment(ALIGN_TOP);
aFont.SetSize(maFontSize);
aFont.SetTransparent(true);
rRenderContext.SetFont(aFont);
@ -556,7 +556,7 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
vcl::Font aFont = rRenderContext.GetFont();
aFont.SetWeight(WEIGHT_LIGHT);
aFont.SetAlign(ALIGN_TOP);
aFont.SetAlignment(ALIGN_TOP);
int nFontHeight = (aSize.Height() - 5) * 2 / (3 * ROW_COUNT);
maFontSize = rRenderContext.PixelToLogic(Size(0, nFontHeight));
aFont.SetSize(maFontSize);

View File

@ -92,7 +92,7 @@ void scaleFontWidth(vcl::Font& rFont, vcl::RenderContext& rRenderContext,long& n
void initFont(vcl::Font& rFont)
{
rFont.SetTransparent(true);
rFont.SetAlign(ALIGN_BASELINE);
rFont.SetAlignment(ALIGN_BASELINE);
}
void setFontSize(vcl::Font& rFont)
@ -118,7 +118,7 @@ void setFont(const SvxFont& rNewFont, SvxFont& rImplFont)
{
rImplFont = rNewFont;
rImplFont.SetTransparent(true);
rImplFont.SetAlign(ALIGN_BASELINE);
rImplFont.SetAlignment(ALIGN_BASELINE);
}
} // end anonymous namespace

View File

@ -987,7 +987,7 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt
FontMetric aFontMetric( mpVD->GetFontMetric() );
vcl::Font aFnt( mpVD->GetFont() );
FontAlign eAlg( aFnt.GetAlign() );
FontAlign eAlg( aFnt.GetAlignment() );
sal_Int32 nTextWidth = (sal_Int32)( mpVD->GetTextWidth( rStr ) * mfScaleX );
sal_Int32 nTextHeight = (sal_Int32)( mpVD->GetTextHeight() * mfScaleY );

View File

@ -502,7 +502,7 @@ inline void SwFont::SetPitch( const FontPitch ePitch, const sal_uInt8 nWhich )
inline void SwSubFont::SetAlign( const FontAlign eAlign )
{
m_pMagic = nullptr;
Font::SetAlign( eAlign );
Font::SetAlignment( eAlign );
}
inline void SwFont::SetAlign( const FontAlign eAlign )

View File

@ -140,7 +140,7 @@ static void lcl_PrintHeader( vcl::RenderContext &rOutDev, sal_Int32 nPages, sal_
vcl::Font aFont( aOldFont );
aFont.SetWeight( WEIGHT_BOLD );
aFont.SetAlign( ALIGN_BOTTOM );
aFont.SetAlignment( ALIGN_BOTTOM );
rOutDev.SetFont( aFont );
long nFontHeight = rOutDev.GetTextHeight();

View File

@ -39,7 +39,8 @@ public:
FontItalic GetItalic() const { return meItalic; }
FontPitch GetPitch() const { return mePitch; }
FontWidth GetWidthType() const { return meWidthType; }
rtl_TextEncoding GetCharSet() const { return meCharSet; }
TextAlign GetAlignment() const { return meAlign; }
rtl_TextEncoding GetCharSet() const { return meCharSet; }
bool IsSymbolFont() const { return mbSymbolFlag; }
@ -51,6 +52,7 @@ public:
void SetItalic(const FontItalic eItalic ) { meItalic = eItalic; }
void SetWeight(const FontWeight eWeight ) { meWeight = eWeight; }
void SetWidthType(const FontWidth eWidthType) { meWidthType = eWidthType; }
void SetAlignment(const TextAlign eAlignment) { meAlign = eAlignment; }
void SetCharSet( const rtl_TextEncoding );
void SetSymbolFlag(const bool );
@ -101,6 +103,7 @@ private:
FontPitch mePitch; // Pitch Type
FontWidth meWidthType; // Width Type
FontItalic meItalic; // Slant Type
TextAlign meAlign; // Text alignment
rtl_TextEncoding meCharSet; // RTL_TEXTENCODING_SYMBOL or RTL_TEXTENCODING_UNICODE
bool mbSymbolFlag; // Is font a symbol?

View File

@ -50,6 +50,7 @@ public:
FontPitch GetPitchNoAsk() const { return mePitch; }
FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); return meWidthType; }
FontWidth GetWidthTypeNoAsk() const { return meWidthType; }
TextAlign GetAlignment() const { return meAlign; }
rtl_TextEncoding GetCharSet() const { return meCharSet; }
bool IsSymbolFont() const { return mbSymbol; }
@ -62,6 +63,7 @@ public:
void SetItalic( const FontItalic eItalic ) { meItalic = eItalic; }
void SetWeight( const FontWeight eWeight ) { meWeight = eWeight; }
void SetWidthType( const FontWidth eWidthType ) { meWidthType = eWidthType; }
void SetAlignment( const TextAlign eAlignment ) { meAlign = eAlignment; }
void SetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; }
void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbol = bSymbolFlag; }

View File

@ -26,6 +26,7 @@ public:
void testWidthType();
void testPitch();
void testItalic();
void testAlignment();
void testQuality();
void testBuiltInFontFlag();
void testEmbeddableFontFlag();
@ -39,6 +40,7 @@ public:
CPPUNIT_TEST(testWidthType);
CPPUNIT_TEST(testPitch);
CPPUNIT_TEST(testItalic);
CPPUNIT_TEST(testAlignment);
CPPUNIT_TEST(testQuality);
CPPUNIT_TEST(testBuiltInFontFlag);
CPPUNIT_TEST(testEmbeddableFontFlag);
@ -91,6 +93,18 @@ void VclFontTest::testItalic()
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Italic should be EXPANDED", FontItalic::ITALIC_NORMAL, aFont.GetItalic());
}
void VclFontTest::testAlignment()
{
vcl::Font aFont;
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_TOP", TextAlign::ALIGN_TOP, aFont.GetAlignment());
aFont.SetAlignment(TextAlign::ALIGN_BASELINE);
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Text alignment should be ALIGN_BASELINE", TextAlign::ALIGN_BASELINE, aFont.GetAlignment());
}
void VclFontTest::testPitch()
{
vcl::Font aFont;

View File

@ -191,8 +191,8 @@ void TextEngine::SetFont( const vcl::Font& rFont )
aFillColor.SetTransparency( 0 );
maFont.SetFillColor( aFillColor );
maFont.SetAlign( ALIGN_TOP );
mpRefDev->SetFont( maFont);
maFont.SetAlignment( ALIGN_TOP );
mpRefDev->SetFont( maFont );
Size aTextSize;
aTextSize.Width() = mpRefDev->GetTextWidth(" ");
aTextSize.Height() = mpRefDev->GetTextHeight();

View File

@ -532,7 +532,7 @@ sal_uInt16 SetTextContext(OutputDevice& rOut, ObjTextType& Atr, bool Kapt, sal_u
aColor=Sgv2SvFarbe(Atr.L.LFarbe,Atr.L.LBFarbe,Atr.L.LIntens); aFont.SetColor(aColor);
aColor=Sgv2SvFarbe(Atr.F.FFarbe,Atr.F.FBFarbe,Atr.F.FIntens); aFont.SetFillColor(aColor);
aFont.SetTransparent(true);
aFont.SetAlign(ALIGN_BASELINE);
aFont.SetAlignment(ALIGN_BASELINE);
nRotation/=10; nRotation=3600-nRotation; if (nRotation==3600) nRotation=0;
aFont.SetOrientation(nRotation);

View File

@ -587,7 +587,7 @@ void EMFWriter::ImplCheckTextAttr()
// TextAlign
sal_uInt32 nTextAlign;
switch( rFont.GetAlign() )
switch( rFont.GetAlignment() )
{
case ALIGN_TOP: nTextAlign = TA_TOP; break;
case ALIGN_BOTTOM: nTextAlign = TA_BOTTOM; break;

View File

@ -1427,11 +1427,11 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b
aTmp.SetTransparent( false );
if ( ( mnTextAlign & TA_BASELINE) == TA_BASELINE )
aTmp.SetAlign( ALIGN_BASELINE );
aTmp.SetAlignment( ALIGN_BASELINE );
else if( ( mnTextAlign & TA_BOTTOM) == TA_BOTTOM )
aTmp.SetAlign( ALIGN_BOTTOM );
aTmp.SetAlignment( ALIGN_BOTTOM );
else
aTmp.SetAlign( ALIGN_TOP );
aTmp.SetAlignment( ALIGN_TOP );
if ( nGfxMode == GM_ADVANCED )
{
@ -1489,7 +1489,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b
{
maLatestFont = aTmp;
mpGDIMetaFile->AddAction( new MetaFontAction( aTmp ) );
mpGDIMetaFile->AddAction( new MetaTextAlignAction( aTmp.GetAlign() ) );
mpGDIMetaFile->AddAction( new MetaTextAlignAction( aTmp.GetAlignment() ) );
mpGDIMetaFile->AddAction( new MetaTextColorAction( aTmp.GetColor() ) );
mpGDIMetaFile->AddAction( new MetaTextFillColorAction( aTmp.GetFillColor(), !aTmp.IsTransparent() ) );
}

View File

@ -1454,9 +1454,9 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
{
aSrcFont.SetCharSet( RTL_TEXTENCODING_MS_1252 );
}
eSrcTextAlign = aSrcFont.GetAlign();
eSrcTextAlign = aSrcFont.GetAlignment();
aSrcTextColor = aSrcFont.GetColor();
aSrcFont.SetAlign( ALIGN_BASELINE );
aSrcFont.SetAlignment( ALIGN_BASELINE );
aSrcFont.SetColor( COL_WHITE );
}
break;
@ -1789,7 +1789,7 @@ bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
vcl::Font aFont;
aFont.SetCharSet( GetExtendedTextEncoding( RTL_TEXTENCODING_MS_1252 ) );
aFont.SetColor( Color( COL_WHITE ) );
aFont.SetAlign( ALIGN_BASELINE );
aFont.SetAlignment( ALIGN_BASELINE );
aDstFont = aSrcFont = aFont;
CreateSelectDeleteFont(aDstFont);

View File

@ -128,12 +128,12 @@ void Font::SetTransparent( bool bTransparent )
}
}
void Font::SetAlign( FontAlign eAlign )
void Font::SetAlignment( FontAlign eAlign )
{
if( mpImplFont->meAlign != eAlign )
{
MakeUnique();
mpImplFont->meAlign = eAlign;
mpImplFont->SetAlignment(eAlign);
}
}
@ -776,7 +776,7 @@ const Color& Font::GetColor() const { return mpImplFont->maColor; }
const Color& Font::GetFillColor() const { return mpImplFont->maFillColor; }
bool Font::IsTransparent() const { return mpImplFont->mbTransparent; }
FontAlign Font::GetAlign() const { return mpImplFont->meAlign; }
FontAlign Font::GetAlignment() const { return mpImplFont->GetAlignment(); }
const OUString& Font::GetFamilyName() const { return mpImplFont->GetFamilyName(); }
const OUString& Font::GetStyleName() const { return mpImplFont->maStyleName; }

View File

@ -28,6 +28,7 @@ FontAttributes::FontAttributes()
mePitch( PITCH_DONTKNOW ),
meWidthType ( WIDTH_DONTKNOW ),
meItalic ( ITALIC_NONE ),
meAlign ( ALIGN_TOP ),
meCharSet( RTL_TEXTENCODING_DONTKNOW ),
mbSymbolFlag( false ),
mnQuality( 0 ),
@ -45,6 +46,7 @@ FontAttributes::FontAttributes( const FontAttributes& rFontAttributes ) :
mePitch( rFontAttributes.mePitch ),
meWidthType( rFontAttributes.meWidthType ),
meItalic( rFontAttributes.meItalic ),
meAlign( rFontAttributes.meAlign ),
meCharSet( rFontAttributes.meCharSet ),
mbSymbolFlag( rFontAttributes.mbSymbolFlag ),
maMapNames( rFontAttributes.maMapNames ),
@ -55,7 +57,6 @@ FontAttributes::FontAttributes( const FontAttributes& rFontAttributes ) :
mbEmbeddable( rFontAttributes.mbEmbeddable )
{}
bool FontAttributes::CompareDeviceIndependentFontAttributes(const FontAttributes& rOther) const
{
if (maFamilyName != rOther.maFamilyName)

View File

@ -8846,7 +8846,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
double fXScale = 1.0;
double fSkew = 0.0;
sal_Int32 nPixelFontHeight = m_pReferenceDevice->mpFontInstance->maFontSelData.mnHeight;
TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlign();
TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlignment();
// transform font height back to current units
// note: the layout calculates in outdevs device pixel !!
@ -9873,7 +9873,7 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout
}
Point aPos( rPos );
TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlign();
TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlignment();
if( eAlign == ALIGN_TOP )
aPos.Y() += HCONV( pFontInstance->mxFontMetric->GetAscent() );
else if( eAlign == ALIGN_BOTTOM )
@ -12066,7 +12066,7 @@ void PDFWriterImpl::pop()
if( ! (aState.m_nFlags & PushFlags::OVERLINECOLOR ) )
setOverlineColor( aState.m_aOverlineColor );
if( ! (aState.m_nFlags & PushFlags::TEXTALIGN ) )
setTextAlign( aState.m_aFont.GetAlign() );
setTextAlign( aState.m_aFont.GetAlignment() );
if( ! (aState.m_nFlags & PushFlags::TEXTFILLCOLOR) )
setTextFillColor( aState.m_aFont.GetFillColor() );
if( ! (aState.m_nFlags & PushFlags::REFPOINT) )

View File

@ -1149,7 +1149,7 @@ public:
void setTextAlign( TextAlign eAlign )
{
m_aGraphicsStack.front().m_aFont.SetAlign( eAlign );
m_aGraphicsStack.front().m_aFont.SetAlignment( eAlign );
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateFont;
}

View File

@ -249,7 +249,7 @@ void ImplWriteFont( SvStream& rOStm, const vcl::Font& rFont,
rOStm.WriteInt16( rActualCharSet );
rOStm.WriteInt16( rFont.GetFamilyType() );
rOStm.WriteInt16( rFont.GetPitch() );
rOStm.WriteInt16( rFont.GetAlign() );
rOStm.WriteInt16( rFont.GetAlignment() );
rOStm.WriteInt16( nWeight );
rOStm.WriteInt16( rFont.GetUnderline() );
rOStm.WriteInt16( rFont.GetStrikeout() );
@ -828,7 +828,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
aFont.SetCharSet( (rtl_TextEncoding) nCharSet );
aFont.SetFamily( (FontFamily) nFamily );
aFont.SetPitch( (FontPitch) nPitch );
aFont.SetAlign( (FontAlign) nAlign );
aFont.SetAlignment( (FontAlign) nAlign );
aFont.SetWeight( ( nWeight == 1 ) ? WEIGHT_LIGHT : ( nWeight == 2 ) ? WEIGHT_NORMAL :
( nWeight == 3 ) ? WEIGHT_BOLD : WEIGHT_DONTKNOW );
aFont.SetUnderline( (FontUnderline) nUnderline );
@ -844,7 +844,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
eActualCharSet = osl_getThreadTextEncoding();
rMtf.AddAction( new MetaFontAction( aFont ) );
rMtf.AddAction( new MetaTextAlignAction( aFont.GetAlign() ) );
rMtf.AddAction( new MetaTextAlignAction( aFont.GetAlignment() ) );
rMtf.AddAction( new MetaTextColorAction( aFont.GetColor() ) );
rMtf.AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
@ -2063,7 +2063,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
{
vcl::Font aSaveFont( rSaveVDev.GetFont() );
aSaveFont.SetAlign( static_cast<const MetaTextAlignAction*>(pAction)->GetTextAlign() );
aSaveFont.SetAlignment( static_cast<const MetaTextAlignAction*>(pAction)->GetTextAlign() );
rSaveVDev.SetFont( aSaveFont );
ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
nCount++;

View File

@ -58,6 +58,7 @@ FontMetric OutputDevice::GetDevFont( int nDevFontIndex ) const
aFontMetric.SetPitch( rData.GetPitch() );
aFontMetric.SetWeight( rData.GetWeight() );
aFontMetric.SetItalic( rData.GetItalic() );
aFontMetric.SetAlignment( rData.GetAlignment() );
aFontMetric.SetWidthType( rData.GetWidthType() );
aFontMetric.SetScalableFlag( rData.IsScalable() );
aFontMetric.SetBuiltInFontFlag( rData.IsBuiltInFont() );
@ -182,6 +183,7 @@ FontMetric OutputDevice::GetFontMetric() const
aMetric.SetPitch( xFontMetric->GetPitch() );
aMetric.SetWeight( xFontMetric->GetWeight() );
aMetric.SetItalic( xFontMetric->GetItalic() );
aMetric.SetAlignment( xFontMetric->GetAlignment() );
aMetric.SetWidthType( xFontMetric->GetWidthType() );
if ( pFontInstance->mnOwnOrientation )
aMetric.SetOrientation( pFontInstance->mnOwnOrientation );
@ -1124,7 +1126,7 @@ bool OutputDevice::ImplNewFont() const
}
// calculate text offset depending on TextAlignment
TextAlign eAlign = maFont.GetAlign();
TextAlign eAlign = maFont.GetAlignment();
if ( eAlign == ALIGN_BASELINE )
{
mnTextOffX = 0;

View File

@ -94,7 +94,7 @@ OutputDevice::OutputDevice() :
mbOutputClipped = false;
maTextColor = Color( COL_BLACK );
maOverlineColor = Color( COL_TRANSPARENT );
meTextAlign = maFont.GetAlign();
meTextAlign = maFont.GetAlignment();
meRasterOp = ROP_OVERPAINT;
mnAntialiasing = AntialiasingFlags::NONE;
meTextLanguage = 0; // TODO: get default from configuration?

View File

@ -532,7 +532,7 @@ void OutputDevice::SetFont( const vcl::Font& rNewFont )
mpMetaFile->AddAction( new MetaFontAction( aFont ) );
// the color and alignment actions don't belong here
// TODO: get rid of them without breaking anything...
mpMetaFile->AddAction( new MetaTextAlignAction( aFont.GetAlign() ) );
mpMetaFile->AddAction( new MetaTextAlignAction( aFont.GetAlignment() ) );
mpMetaFile->AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
}

View File

@ -806,9 +806,9 @@ void OutputDevice::SetTextAlign( TextAlign eAlign )
if ( mpMetaFile )
mpMetaFile->AddAction( new MetaTextAlignAction( eAlign ) );
if ( maFont.GetAlign() != eAlign )
if ( maFont.GetAlignment() != eAlign )
{
maFont.SetAlign( eAlign );
maFont.SetAlignment( eAlign );
mbNewFont = true;
}