summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMert Tumer <mert.tumer@collabora.com>2019-10-24 12:11:21 +0300
committerAshod Nakashian <ashnakash@gmail.com>2019-11-10 22:39:55 +0100
commit7c8450abac77a2e41f1068fb11d19c1c0c93783f (patch)
treecf9257e7ea5888f6414726602fd952635c3c7f7a /filter
parentec7374ff84c71edfbb30d6e4dc5b486b6df7107f (diff)
Added Orientation argument to LOKIT renderFont
method for rendering watermarks with angle Change-Id: Id422ed62e4f78390661e4e1efa45101af9ecfc23 Reviewed-on: https://gerrit.libreoffice.org/81435 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/pdf/pdfexport.cxx23
1 files changed, 6 insertions, 17 deletions
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 6e24495c610e..c24e3e6581f4 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1169,26 +1169,16 @@ void PDFExport::ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSi
void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize )
{
OUString watermark = msTiledWatermark;
- int watermarkLength = watermark.getLength();
// Maximum number of characters in one line.
// it is set to 21 to make it look like tiled watermarks as online in secure view
const int lineLength = 21;
- int lnIndex = lineLength;
- int lnCount = watermarkLength / lineLength;
-
- while(lnCount)
- {
- watermark = watermark.replaceAt(lnIndex, 0, "\n");
- lnIndex += lineLength;
- lnCount--;
- }
-
vcl::Font aFont( "Liberation Sans", Size( 0, 40 ) );
aFont.SetItalic( ITALIC_NONE );
aFont.SetWidthType( WIDTH_NORMAL );
aFont.SetWeight( WEIGHT_NORMAL );
aFont.SetAlignment( ALIGN_BOTTOM );
aFont.SetFontHeight(40);
+ aFont.SetOrientation(450);
OutputDevice* pDev = rWriter.GetReferenceDevice();
pDev->SetFont(aFont);
@@ -1212,7 +1202,6 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
aFont.SetFontHeight(nNewHeight);
pDev->SetFont( aFont );
}
-
// maximum number of watermark count for the width
if(watermarkcount > 8)
watermarkcount = 8;
@@ -1224,20 +1213,20 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
rWriter.SetFont(aFont);
rWriter.SetTextColor( Color(19,20,22) );
// center watermarks horizontally
- Point aTextPoint( (rPageSize.Width()/2) - (((nTextWidth*watermarkcount)+(watermarkcount-1)*(nTextWidth/2))/2),
+ Point aTextPoint( (rPageSize.Width()/2) - (((nTextWidth*watermarkcount)+(watermarkcount-1)*nTextWidth)/2),
pDev->GetTextHeight());
for( int i = 0; i < watermarkcount; i ++)
{
- while(aTextPoint.getY()+pDev->GetTextHeight()*2 <= rPageSize.Height())
+ while(aTextPoint.getY()+pDev->GetTextHeight()*3 <= rPageSize.Height())
{
- tools::Rectangle aTextRect(aTextPoint, Size(nTextWidth,pDev->GetTextHeight()*2));
+ tools::Rectangle aTextRect(aTextPoint, Size(nTextWidth*2,pDev->GetTextHeight()*4));
pDev->Push();
rWriter.SetClipRegion();
rWriter.BeginTransparencyGroup();
rWriter.SetTextColor( Color(19,20,22) );
- rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter);
+ rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter|DrawTextFlags::WordBreak|DrawTextFlags::Bottom);
rWriter.EndTransparencyGroup( aTextRect, 50 );
pDev->Pop();
@@ -1245,7 +1234,7 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
rWriter.SetClipRegion();
rWriter.BeginTransparencyGroup();
rWriter.SetTextColor( Color(236,235,233) );
- rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter);
+ rWriter.DrawText(aTextRect, watermark, DrawTextFlags::MultiLine|DrawTextFlags::Center|DrawTextFlags::VCenter|DrawTextFlags::WordBreak|DrawTextFlags::Bottom);
rWriter.EndTransparencyGroup( aTextRect, 50 );
pDev->Pop();