Lines Matching defs:dw
48 static void ParseDrawFunction(DviWidget dw, char *buf);
49 static void ParseDeviceControl(DviWidget dw);
50 static void PutCharacters(DviWidget dw, unsigned char *src, int len);
51 static void push_env(DviWidget dw);
52 static void pop_env(DviWidget dw);
56 charWidth(DviWidget dw, XftFont *font, char c)
60 XftTextExtents8(XtDisplay(dw), font, (unsigned char *) &c, 1, &extents);
64 #define charWidth(dw,fi,c) (\
73 ParseInput(DviWidget dw)
81 if (!dw->dvi.state)
82 push_env(dw);
86 switch (DviGetC(dw, &c)) {
93 push_env(dw);
96 pop_env(dw);
113 HorizontalMove(dw, (c - '0') * 10 + DviGetC(dw, &otherc) - '0');
117 (void) DviGetC(dw, &c);
122 PutCharacters(dw, &tc, 1);
126 GetWord(dw, Buffer, BUFSIZ);
132 map = QueryFontMap(dw, dw->dvi.state->font_number);
139 PutCharacters(dw, ligature, l);
146 for (int i = 1; (map = QueryFontMap(dw, i)); i++) {
149 prevFont = dw->dvi.state->font_number;
150 dw->dvi.state->font_number = i;
158 PutCharacters(dw, &tc, 1);
161 dw->dvi.state->font_number = prevFont;
165 GetLine(dw, Buffer, BUFSIZ);
166 ParseDrawFunction(dw, Buffer);
170 int n = GetNumber(dw);
171 if (!dw->dvi.size_scale) {
180 dw->dvi.size_scale = guesses[i];
182 dw->dvi.state->font_size = n;
183 dw->dvi.state->line_width = n * (dw->dvi.device_resolution /
184 (720 * dw->dvi.size_scale));
189 int n = GetNumber(dw);
190 dw->dvi.state->font_number = n;
195 int k = GetNumber(dw);
196 HorizontalGoto(dw, k);
201 int k = GetNumber(dw);
202 HorizontalMove(dw, k);
209 int n = GetNumber(dw);
210 VerticalGoto(dw, n);
215 int n = GetNumber(dw);
216 VerticalMove(dw, n);
225 (void) GetNumber(dw);
226 NextPage = dw->dvi.current_page + 1;
227 RememberPagePosition(dw, NextPage);
228 FlushCharCache(dw);
232 GetNumber(dw);
233 GetNumber(dw);
234 HorizontalGoto(dw, 0);
238 GetLine(dw, NULL, 0);
241 GetLine(dw, Buffer, BUFSIZ);
242 PutCharacters(dw, (unsigned char *) Buffer, strlen(Buffer));
243 dw->dvi.state->x = ToDevice(dw, dw->dvi.cache.x);
246 ParseDeviceControl(dw);
249 dw->dvi.last_page = dw->dvi.current_page;
250 FlushCharCache(dw);
251 return dw->dvi.current_page;
253 GetLine(dw, Buffer, BUFSIZ);
261 push_env(DviWidget dw)
265 if (dw->dvi.state)
266 *new = *(dw->dvi.state);
268 new->font_size = 10 * dw->dvi.size_scale;
275 new->next = dw->dvi.state;
276 dw->dvi.state = new;
280 pop_env(DviWidget dw)
282 DviState *old = dw->dvi.state;
283 dw->dvi.state = old->next;
288 InitTypesetter(DviWidget dw)
290 while (dw->dvi.state)
291 pop_env(dw);
292 dw->dvi.size_scale = dw->dvi.size_scale_set;
293 push_env(dw);
294 FlushCharCache(dw);
298 SetFont(DviWidget dw)
300 dw->dvi.cache.font_size = dw->dvi.state->font_size;
301 dw->dvi.cache.font_number = dw->dvi.state->font_number;
302 dw->dvi.cache.font = QueryFont(dw,
303 dw->dvi.cache.font_number,
304 dw->dvi.cache.font_size);
308 PutCharacters(DviWidget dw, unsigned char *src, int len)
312 int xx = ToX(dw, dw->dvi.state->x);
313 int yx = ToX(dw, dw->dvi.state->y);
314 int fy = FontSizeInPixels(dw, dw->dvi.state->font_size);
320 if (yx + fy >= dw->dvi.extents.y1 &&
321 yx - fy <= dw->dvi.extents.y2 &&
322 xx + fx >= dw->dvi.extents.x1 && xx - fx <= dw->dvi.extents.x2) {
331 if (!dw->dvi.display_enable)
334 if (yx != dw->dvi.cache.y ||
335 dw->dvi.cache.char_index + len > DVI_CHAR_CACHE_SIZE)
336 FlushCharCache(dw);
341 if (dw->dvi.cache.font_size != dw->dvi.state->font_size ||
342 dw->dvi.cache.font_number != dw->dvi.state->font_number) {
343 SetFont(dw);
344 if (dw->dvi.cache.cache[dw->dvi.cache.index].nchars != 0) {
345 ++dw->dvi.cache.index;
346 if (dw->dvi.cache.index >= dw->dvi.cache.max)
347 FlushCharCache(dw);
348 dw->dvi.cache.cache[dw->dvi.cache.index].nchars = 0;
351 if (xx != dw->dvi.cache.x) {
352 if (dw->dvi.cache.cache[dw->dvi.cache.index].nchars != 0) {
353 ++dw->dvi.cache.index;
354 if (dw->dvi.cache.index >= dw->dvi.cache.max)
355 FlushCharCache(dw);
356 dw->dvi.cache.cache[dw->dvi.cache.index].nchars = 0;
359 if (!dw->dvi.cache.font)
360 SetFont(dw);
361 text = &dw->dvi.cache.cache[dw->dvi.cache.index];
362 font = dw->dvi.cache.font;
363 dst = &dw->dvi.cache.char_cache[dw->dvi.cache.char_index];
369 text->delta = xx - dw->dvi.cache.x;
374 if (font != dw->dvi.font) {
378 dw->dvi.font = font;
384 dw->dvi.cache.x = xx;
386 dw->dvi.cache.char_index += len;
392 dw->dvi.cache.x += charWidth(dw, font, c);
398 ParseDrawFunction(DviWidget dw, char *buf)
402 SetGCForDraw(dw);
406 DrawLine(dw, n, m);
410 DrawCircle(dw, n);
414 DrawEllipse(dw, m, n);
418 DrawArc(dw, n, m, n1, m1);
421 DrawSpline(dw, buf + 1, 1);
425 dw->dvi.state->line_width = n;
440 ParseDeviceControl(DviWidget dw)
445 GetWord(dw, str, 20);
448 GetWord(dw, str, 20);
451 InitTypesetter(dw);
460 SetDeviceResolution(dw, GetNumber(dw));
464 int n = GetNumber(dw);
467 GetWord(dw, str, 20);
468 GetLine(dw, str1, 50);
469 SetFontPosition(dw, n, str, str1);
477 while (DviGetC(dw, &c) != '\n') /* skip rest of input line */