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.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_H
0010 #define _TEXFONT_H
0011 
0012 #include "TeXFontDefinition.h"
0013 #include "glyph.h"
0014 
0015 class TeXFont
0016 {
0017 public:
0018     explicit TeXFont(TeXFontDefinition *_parent)
0019     {
0020         parent = _parent;
0021         errorMessage.clear();
0022     }
0023 
0024     virtual ~TeXFont();
0025 
0026     TeXFont(const TeXFont &) = delete;
0027     TeXFont &operator=(const TeXFont &) = delete;
0028 
0029     void setDisplayResolution()
0030     {
0031         for (glyph &g : glyphtable) {
0032             g.shrunkenCharacter = QImage();
0033         }
0034     }
0035 
0036     virtual glyph *getGlyph(quint16 character, bool generateCharacterPixmap = false, const QColor &color = Qt::black) = 0;
0037 
0038     // Checksum of the font. Used e.g. by PK fonts. This field is filled
0039     // in by the constructor, or set to 0.0, if the font format does not
0040     // contain checksums.
0041     quint32 checksum;
0042 
0043     // If the font or if some glyphs could not be loaded, error messages
0044     // will be put here.
0045     QString errorMessage;
0046 
0047 protected:
0048     glyph glyphtable[TeXFontDefinition::max_num_of_chars_in_font];
0049     TeXFontDefinition *parent;
0050 };
0051 
0052 #endif