From eba183d4de47093c6e44a99c8d7fe313aa2834c9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:42 -0600 Subject: Fix FTBFS --- kcontrol/tdefontinst/viewpart/KfiPrint.cpp | 193 +++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 kcontrol/tdefontinst/viewpart/KfiPrint.cpp (limited to 'kcontrol/tdefontinst/viewpart/KfiPrint.cpp') diff --git a/kcontrol/tdefontinst/viewpart/KfiPrint.cpp b/kcontrol/tdefontinst/viewpart/KfiPrint.cpp new file mode 100644 index 000000000..5e2d9deeb --- /dev/null +++ b/kcontrol/tdefontinst/viewpart/KfiPrint.cpp @@ -0,0 +1,193 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Namespace : KFI::Print +// Author : Craig Drummond +// Project : K Font Installer +// Creation Date : 14/05/2005 +// Version : $Revision$ $Date$ +// +//////////////////////////////////////////////////////////////////////////////// +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program 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 General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//////////////////////////////////////////////////////////////////////////////// +// (C) Craig Drummond, 2005 +//////////////////////////////////////////////////////////////////////////////// + +#include "KfiPrint.h" +#include "FcEngine.h" +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_LOCALE_H +#include +#endif + +namespace KFI +{ + +namespace Print +{ + +static const int constMarginLineBefore=1; +static const int constMarginLineAfter=2; +static const int constMarginFont=4; + +inline bool sufficientSpace(int y, int pageHeight, int size) +{ + return (y+constMarginFont+size)processEvents(TQEventLoop::ExcludeUserInput, 0); + + if(!firstFont && !sufficientSpace(y, painter.fontMetrics().height(), sizes, pageHeight, size)) + { + printer.newPage(); + y=margin; + } + painter.setFont(sans); + y+=painter.fontMetrics().height(); + painter.drawText(margin, y, *it); + y+=constMarginLineBefore; + painter.drawLine(margin, y, margin+pageWidth, y); + y+=constMarginLineAfter; + + if(0==size) + { + y+=CFcEngine::constDefaultAlphaSize; + painter.setFont(engine.getQFont(*it, CFcEngine::constDefaultAlphaSize)); + painter.drawText(margin, y, CFcEngine::getLowercaseLetters()); + y+=constMarginFont+CFcEngine::constDefaultAlphaSize; + painter.drawText(margin, y, CFcEngine::getUppercaseLetters()); + y+=constMarginFont+CFcEngine::constDefaultAlphaSize; + painter.drawText(margin, y, CFcEngine::getPunctuation()); + y+=constMarginFont+constMarginLineBefore; + painter.drawLine(margin, y, margin+pageWidth, y); + y+=constMarginLineAfter; + } + for(; sizes[s]; ++s) + { + y+=sizes[s]; + painter.setFont(engine.getQFont(*it, sizes[s])); + if(sufficientSpace(y, pageHeight, sizes[s])) + { + painter.drawText(margin, y, str); + if(sizes[s+1]) + y+=constMarginFont; + } + } + firstFont=false; + y+=(s<1 || sizes[s-1]<25 ? 14 : 28); + } + + painter.end(); + + // + // Did we change the users font settings? If so, reset to their previous values... + if(set) + if(entryExists) + settings.writeEntry("/qt/embedFonts", false); + else + settings.removeEntry("/qt/embedFonts"); + } +#ifdef HAVE_LOCALE_H + if(oldLocale) + setlocale(LC_NUMERIC, oldLocale); +#endif +} + +} + +} -- cgit v1.2.1