From 38a5a3f526393f929c648b37cd95b41a3af9deef Mon Sep 17 00:00:00 2001 From: Fabio D'Urso Date: Fri, 27 Jul 2012 15:46:44 +0200 Subject: [PATCH] Made font configurable in inplace text annotations --- conf/widgetannottools.cpp | 11 ++++++++++- ui/pageviewannotator.cpp | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/conf/widgetannottools.cpp b/conf/widgetannottools.cpp index a7577fc85..d0f2bd497 100644 --- a/conf/widgetannottools.cpp +++ b/conf/widgetannottools.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -351,7 +352,8 @@ QDomDocument EditAnnotToolDialog::toolXml() const engineElement.setAttribute( "block", "true" ); annotationElement.setAttribute( "type", "FreeText" ); annotationElement.setAttribute( "color", color ); - // TODO: Font + if ( ta->textFont() != QApplication::font() ) + annotationElement.setAttribute( "font", ta->textFont().toString() ); } else if ( toolType == "ink" ) { @@ -590,6 +592,13 @@ void EditAnnotToolDialog::loadTool( const QDomElement &toolElement ) else if ( annotType == "note-inline" ) { setToolType( "note-inline" ); + Okular::TextAnnotation * ta = static_cast( m_stubann ); + if ( annotationElement.hasAttribute( "font" ) ) + { + QFont f; + f.fromString( annotationElement.attribute( "font" ) ); + ta->setTextFont( f ); + } } else if ( annotType == "note-linked" ) { diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp index 50299fea3..4a0c6f2fd 100644 --- a/ui/pageviewannotator.cpp +++ b/ui/pageviewannotator.cpp @@ -167,6 +167,13 @@ class PickPointEngine : public AnnotatorEngine ann = ta; ta->setInplaceText( note ); ta->setTextType( Okular::TextAnnotation::InPlace ); + //set font + if ( m_annotElement.hasAttribute( "font" ) ) + { + QFont f; + f.fromString( m_annotElement.attribute( "font" ) ); + ta->setTextFont( f ); + } //set boundary rect.left = qMin(startpoint.x,point.x); rect.top = qMin(startpoint.y,point.y);