1 /* wvWare
2  * Copyright (C) Caolan McNamara, Dom Lachowicz, and others
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
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., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include <sys/types.h>
25 #include <string.h>
26 #include <stdio.h>
27 #include "wv.h"
28 
29 void
wvGetDOPTYPOGRAPHY(DOPTYPOGRAPHY * dopt,wvStream * fd)30 wvGetDOPTYPOGRAPHY (DOPTYPOGRAPHY * dopt, wvStream * fd)
31 {
32     int i;
33     U16 temp16 = read_16ubit (fd);
34 
35     dopt->fKerningPunct = temp16 & 0x0001;
36     dopt->iJustification = (temp16 & 0x0006) >> 1;
37     dopt->iLevelOfKinsoku = (temp16 & 0x0018) >> 3;
38     dopt->f2on1 = (temp16 & 0x0020) >> 5;
39     dopt->reserved = (temp16 & 0xFFC0) >> 6;
40 
41     dopt->cchFollowingPunct = read_16ubit (fd);
42     dopt->cchLeadingPunct = read_16ubit (fd);
43 
44     for (i = 0; i < 101; i++)
45 	dopt->rgxchFPunct[i] = read_16ubit (fd);
46 
47     for (i = 0; i < 51; i++)
48 	dopt->rgxchLPunct[i] = read_16ubit (fd);
49 }
50 
51 void
wvInitDOPTYPOGRAPHY(DOPTYPOGRAPHY * dopt)52 wvInitDOPTYPOGRAPHY (DOPTYPOGRAPHY * dopt)
53 {
54     int i;
55     dopt->fKerningPunct = 0;
56     dopt->iJustification = 0;
57     dopt->iLevelOfKinsoku = 0;
58     dopt->f2on1 = 0;
59     dopt->reserved = 0;
60     dopt->cchFollowingPunct = 0;
61     dopt->cchLeadingPunct = 0;
62     for (i = 0; i < 101; i++)
63 	dopt->rgxchFPunct[i] = 0;
64     for (i = 0; i < 51; i++)
65 	dopt->rgxchLPunct[i] = 0;
66 }
67