Subversion Repositories filter_foundry

Rev

Rev 193 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
259 daniel-mar 1
/*
2
        This file is part of a common library
3
    Copyright (C) 1990-2006 Toby Thain, toby@telegraphics.com.au
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 as published by  
7
    the Free Software Foundation; either version 2 of the License, or
8
    (at your option) any later version.
9
 
10
    This program is distributed in the hope that it will be useful,
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
    GNU General Public License for more details.
14
 
15
    You should have received a copy of the GNU General Public License  
16
    along with this program; if not, write to the Free Software
17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
*/
19
 
20
#include <memory.h>
21
#include <fonts.h>
22
#include <stdlib.h>
23
 
24
void base_font_name(char *s,Handle FOND){
25
        StyleTable *st;
26
        unsigned char *p,*q,**nt,**n,hs;
27
        int i;
28
        FamRec *f;
29
 
30
        hs = HGetState(FOND);
31
        HLock(FOND);
32
        f = (FamRec*)*FOND;
33
 
34
        if(f->ffStylOff){
35
                st = (StyleTable*)((char*)f + f->ffStylOff);
36
                p = (unsigned char*)st->indexes + 48;
37
                i = *(short*)p;
38
                p += 2;
39
                nt = n = malloc(i*sizeof(char*));
40
                while(i--){
41
                        *n++ = p;
42
                        p += *p + 1;
43
                }
44
                memcpy(s,nt[0]+1,*nt[0]); // base font name
45
                s += *nt[0];
46
//              *s++ = '.';
47
                if(i = st->indexes[0/*plain*/] - 1)
48
                        for(p = nt[i], i = *p++; i--;){
49
                                q = nt[*p++ - 1];
50
                                memcpy(s,q+1,*q); // append suffix
51
                                s += *q;
52
//                              *s++ = '.';
53
                        }
54
                free(nt);
55
        }
56
        *s = 0;
57
 
58
        HSetState(FOND,hs);
59
}
60
 
61
#if 0
62
class(char c){
63
        if(isupper(c))
64
                return 1;
65
        else if(islower(c))
66
                return 2;
67
        else if(isalpha(c))
68
                return 3;
69
        else
70
                return 4;
71
}
72
 
73
void convert53(char *d,char *s){
74
        int cl = class(*s),n = 5;
75
        for(;*s;s++){
76
                if((newcl = class(*s)) != cl){
77
                        n = 3;
78
                        cl = newcl;
79
                }
80
                if(n){
81
                        *d++ = *s;
82
                        n--;
83
                }
84
        }
85
}
193 daniel-mar 86
#endif