File indexing completed on 2024-05-12 04:33:59
0001 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; c-brace-offset: 0; -*- 0002 // TeXFont_TFM.h 0003 // 0004 // Part of KDVI - A DVI previewer for the KDE desktop environment 0005 // 0006 // SPDX-FileCopyrightText: 2003 Stefan Kebekus 0007 // SPDX-License-Identifier: GPL-2.0-or-later 0008 0009 #ifndef _TEXFONT_TFM_H 0010 #define _TEXFONT_TFM_H 0011 0012 #include "TeXFont.h" 0013 0014 class fix_word 0015 { 0016 public: 0017 void fromINT32(qint32 val) 0018 { 0019 value = val; 0020 } 0021 void fromDouble(double val) 0022 { 0023 value = (qint32)(val * (1 << 20) + 0.5); 0024 } 0025 double toDouble() 0026 { 0027 return (double(value)) / (double(1 << 20)); 0028 } 0029 0030 qint32 value; 0031 }; 0032 0033 class TeXFont_TFM : public TeXFont 0034 { 0035 public: 0036 explicit TeXFont_TFM(TeXFontDefinition *parent); 0037 ~TeXFont_TFM() override; 0038 0039 glyph *getGlyph(quint16 character, bool generateCharacterPixmap = false, const QColor &color = Qt::black) override; 0040 0041 private: 0042 fix_word characterWidth_in_units_of_design_size[256]; 0043 fix_word characterHeight_in_units_of_design_size[256]; 0044 0045 fix_word design_size_in_TeX_points; 0046 }; 0047 0048 #endif