"Fossies" - the Fresh Open Source Software Archive

Member "yudit-3.0.7/swindow/SFontCFF.h" (6 Jun 2020, 4745 Bytes) of package /linux/misc/yudit-3.0.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "SFontCFF.h" see the Fossies "Dox" file reference documentation.

    1 /** *  Yudit Unicode Editor Source File
    2  *
    3  *  GNU Copyright (C) 1997-2006  Gaspar Sinai <gaspar@yudit.org>  
    4  *
    5  *  This program is free software; you can redistribute it and/or modify
    6  *  it under the terms of the GNU General Public License, version 2,
    7  *  dated June 1991. See file COPYYING for details.
    8  *
    9  *  This program is distributed in the hope that it will be useful,
   10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   12  *  GNU General Public License for more details.
   13  *
   14  *  You should have received a copy of the GNU General Public License
   15  *  along with this program; if not, write to the Free Software
   16  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   17  */
   18 
   19 #ifndef SFontCFF_h
   20 #define SFontCFF_h
   21 
   22 #include "swindow/SCanvas.h"
   23 #include "swindow/STTables.h"
   24 
   25 
   26 class SFontCFF  {
   27 public:
   28     SFontCFF (void);
   29     ~SFontCFF ();
   30 
   31     bool initWithCFF(SD_BYTE* aCff);
   32     bool initWithCFF2(SD_BYTE* aCff2);
   33 
   34     void drawGlyphCFF (SCanvas* canvas, const SS_Matrix2D& matrix,
   35       SS_GlyphIndex glyphno);
   36 
   37     bool getBBOXCFF (SS_GlyphIndex glyphno,
   38       int* xMin, int* yMin, int* xMax, int* yMax) const;
   39 
   40 protected:
   41     SCanvas* canvas;
   42     SS_Matrix2D matrix;
   43 
   44     SBinVector<double> stack;
   45     bool parseCharStrings (SD_BYTE* strings, SD_ULONG len);
   46     // 0 ok 1 return -1 nok.
   47     int execute (SS_SINT_32 command);
   48     double lastX;
   49     double lastY;
   50     unsigned int subrCount;
   51 
   52     unsigned int stackLimit;
   53     unsigned int subrLimit;
   54 
   55     bool charStringsBegin;
   56     int  commandCounter;
   57     int stemCount; 
   58     bool hintStart; 
   59     bool hasGlyphWidth;
   60     double glyphWidth; // matrix not applied.
   61 
   62 private: 
   63     SD_BYTE* getType2Glyph (SS_GlyphIndex glyphno, SD_ULONG* len) const;
   64     bool updateLocalSubr (SS_GlyphIndex glyphno);
   65 
   66     SD_BYTE* cff;
   67     SD_BYTE* cff2;
   68 
   69     SString firstName;
   70 
   71     SD_BYTE* firstDict;
   72     SD_ULONG firstDictLength;
   73 
   74     SD_BYTE* firstCharStringsIndex;
   75     SD_ULONG firstCharStringsLength;
   76 
   77     SD_BYTE* globalSubrIndex;
   78     SD_ULONG globalSubrLength;
   79 
   80     SD_BYTE* fontDictIndex;
   81     SD_ULONG fontDictLength;
   82 
   83     SD_BYTE* fontDictSelect;
   84 
   85     SD_BYTE* localSubrIndex;
   86     SD_ULONG localSubrLength;
   87 
   88     double transientArray[32];
   89 };
   90 
   91 // CFF
   92 
   93 // header size -  32 padding.
   94 
   95 /* 
   96   INDEX
   97   Card16    count;  // how much data is there in index, for cff2 it is Card32   
   98   / if count is zero there is no osize and offset.
   99   Card8     osize;  // Offset is 1 2 3 4 bytes.
  100   Offset    offset[count+1]
  101   Card8     data[]
  102 
  103   DICT
  104   
  105 */
  106 // Indexes follow header.
  107 // NameIndex, TopDICTIndex, StringIndex, GlobalSubrIndex
  108 
  109 // any place
  110 // Encodings
  111 
  112 // any place
  113 // Charsets
  114 
  115 // FDSelect
  116 
  117 // CharStringsIndex, FontDictIndex, PrivateDICT, LocalSubrINDEX
  118 
  119 #define SS_CFF_COMMAND_hstem 0x0001
  120 // reserverd
  121 #define SS_CFF_COMMAND_vstem 0x0003
  122 #define SS_CFF_COMMAND_vmoveto 0x0004
  123 #define SS_CFF_COMMAND_rlineto 0x0005
  124 #define SS_CFF_COMMAND_hlineto 0x0006
  125 #define SS_CFF_COMMAND_vlineto 0x0007
  126 #define SS_CFF_COMMAND_rrcurveto 0x0008
  127 // reserveed
  128 #define SS_CFF_COMMAND_callsubr 0x000a
  129 #define SS_CFF_COMMAND_return 0x000b
  130 // 0x0c escape
  131 // reserved
  132 #define SS_CFF_COMMAND_endchar 0x000e
  133 
  134 #define SS_CFF_COMMAND_CFF2_vsindex 0x000f
  135 #define SS_CFF_COMMAND_CFF2_blend 0x0010
  136 
  137 // reserved
  138 #define SS_CFF_COMMAND_hstemhm 0x0012
  139 #define SS_CFF_COMMAND_hintmask 0x0013
  140 #define SS_CFF_COMMAND_cntrmask 0x0014
  141 
  142 #define SS_CFF_COMMAND_rmoveto 0x0015
  143 #define SS_CFF_COMMAND_hmoveto 0x0016
  144 #define SS_CFF_COMMAND_vstemhm 0x0017
  145 #define SS_CFF_COMMAND_rcurveline 0x0018
  146 #define SS_CFF_COMMAND_rlinecurve 0x0019
  147 #define SS_CFF_COMMAND_vvcurveto 0x001a
  148 #define SS_CFF_COMMAND_hhcurveto 0x001b
  149 #define SS_CFF_COMMAND_shortint 0x001c
  150 #define SS_CFF_COMMAND_callgsubr 0x001d
  151 #define SS_CFF_COMMAND_vhcurveto 0x001e
  152 #define SS_CFF_COMMAND_hvcurveto 0x001f
  153 
  154 #define SS_CFF_COMMAND_hflex 0x0c22
  155 #define SS_CFF_COMMAND_flex 0x0c23
  156 #define SS_CFF_COMMAND_hflex1 0x0c24
  157 #define SS_CFF_COMMAND_flex1 0x0c25
  158 // 
  159 #define SS_CFF_COMMAND_and 0x0c03
  160 #define SS_CFF_COMMAND_or 0x0c04
  161 #define SS_CFF_COMMAND_not 0x0c05
  162 #define SS_CFF_COMMAND_abs 0x0c09
  163 //
  164 #define SS_CFF_COMMAND_add 0x0c0a
  165 #define SS_CFF_COMMAND_sub 0x0c0b
  166 #define SS_CFF_COMMAND_div 0x0c0c
  167 //
  168 #define SS_CFF_COMMAND_neg 0x0c0e
  169 #define SS_CFF_COMMAND_eq 0x0c0f
  170 //
  171 #define SS_CFF_COMMAND_drop 0x0c12
  172 //
  173 #define SS_CFF_COMMAND_put 0x0c14
  174 #define SS_CFF_COMMAND_get 0x0c15
  175 #define SS_CFF_COMMAND_ifelse 0x0c16
  176 #define SS_CFF_COMMAND_random 0x0c17
  177 #define SS_CFF_COMMAND_mul 0x0c18
  178 //
  179 #define SS_CFF_COMMAND_sqrt 0x0c1a
  180 #define SS_CFF_COMMAND_dup 0x0c1b
  181 #define SS_CFF_COMMAND_exch 0x0c1c
  182 #define SS_CFF_COMMAND_index 0x0c1d
  183 #define SS_CFF_COMMAND_roll 0x0c1e
  184 //
  185 
  186 
  187 
  188 #endif /* SFontCFF_h */