From 13a06349251874bd35d2f03c3fc93217cee749a2 Mon Sep 17 00:00:00 2001 From: Nickolay V. Shmyrev Date: Mon, 08 Jan 2007 12:25:31 +0000 Subject: Reorganize source tree. 2007-01-08 Nickolay V. Shmyrev * Makefile.am: * backend/Makefile.am: * backend/comics/Makefile.am: * backend/djvu/Makefile.am: * backend/dvi/Makefile.am: * backend/ev-async-renderer.c: * backend/ev-async-renderer.h: * backend/ev-attachment.c: * backend/ev-attachment.h: * backend/ev-backend-marshal.c: * backend/ev-document-factory.c: * backend/ev-document-factory.h: * backend/ev-document-find.c: * backend/ev-document-find.h: * backend/ev-document-fonts.c: * backend/ev-document-fonts.h: * backend/ev-document-images.c: * backend/ev-document-images.h: * backend/ev-document-info.h: * backend/ev-document-links.c: * backend/ev-document-links.h: * backend/ev-document-misc.c: * backend/ev-document-misc.h: * backend/ev-document-security.c: * backend/ev-document-security.h: * backend/ev-document-thumbnails.c: * backend/ev-document-thumbnails.h: * backend/ev-document-transition.c: * backend/ev-document-transition.h: * backend/ev-document.c: * backend/ev-document.h: * backend/ev-file-exporter.c: * backend/ev-file-exporter.h: * backend/ev-image.c: * backend/ev-image.h: * backend/ev-link-action.c: * backend/ev-link-action.h: * backend/ev-link-dest.c: * backend/ev-link-dest.h: * backend/ev-link.c: * backend/ev-link.h: * backend/ev-render-context.c: * backend/ev-render-context.h: * backend/ev-selection.c: * backend/ev-selection.h: * backend/impress/Makefile.am: * backend/pdf/Makefile.am: * backend/pixbuf/Makefile.am: * backend/ps/Makefile.am: * backend/ps/ps-document.c: (push_pixbuf), (interpreter_failed), (ps_document_widget_event), (setup_pixmap), (setup_page), (input), (start_interpreter), (stop_interpreter), (document_load), (ps_document_next_page), (render_page): * backend/tiff/Makefile.am: * comics/Makefile.am: * comics/comics-document.c: * comics/comics-document.h: * configure.ac: * cut-n-paste/zoom-control/ephy-zoom-control.c: * djvu/Makefile.am: * djvu/djvu-document-private.h: * djvu/djvu-document.c: * djvu/djvu-document.h: * djvu/djvu-links.c: * djvu/djvu-links.h: * djvu/djvu-text-page.c: * djvu/djvu-text-page.h: * djvu/djvu-text.c: * djvu/djvu-text.h: * dvi/Makefile.am: * dvi/dvi-document.c: * dvi/dvi-document.h: * dvi/fonts.c: * dvi/fonts.h: * dvi/mdvi-lib/Makefile.am: * dvi/mdvi-lib/afmparse.c: * dvi/mdvi-lib/afmparse.h: * dvi/mdvi-lib/bitmap.c: * dvi/mdvi-lib/bitmap.h: * dvi/mdvi-lib/color.c: * dvi/mdvi-lib/color.h: * dvi/mdvi-lib/common.c: * dvi/mdvi-lib/common.h: * dvi/mdvi-lib/defaults.h: * dvi/mdvi-lib/dvimisc.c: * dvi/mdvi-lib/dviopcodes.h: * dvi/mdvi-lib/dviread.c: * dvi/mdvi-lib/files.c: * dvi/mdvi-lib/font.c: * dvi/mdvi-lib/fontmap.c: * dvi/mdvi-lib/fontmap.h: * dvi/mdvi-lib/fontsrch.c: * dvi/mdvi-lib/gf.c: * dvi/mdvi-lib/hash.c: * dvi/mdvi-lib/hash.h: * dvi/mdvi-lib/list.c: * dvi/mdvi-lib/mdvi.h: * dvi/mdvi-lib/pagesel.c: * dvi/mdvi-lib/paper.c: * dvi/mdvi-lib/paper.h: * dvi/mdvi-lib/pk.c: * dvi/mdvi-lib/private.h: * dvi/mdvi-lib/setup.c: * dvi/mdvi-lib/sp-epsf.c: * dvi/mdvi-lib/special.c: * dvi/mdvi-lib/sysdeps.h: * dvi/mdvi-lib/t1.c: * dvi/mdvi-lib/tfm.c: * dvi/mdvi-lib/tfmfile.c: * dvi/mdvi-lib/tt.c: * dvi/mdvi-lib/util.c: * dvi/mdvi-lib/vf.c: * dvi/pixbuf-device.c: * dvi/pixbuf-device.h: * impress/Makefile.am: * impress/common.h: * impress/document.c: * impress/f_oasis.c: * impress/f_oo13.c: * impress/iksemel.c: * impress/iksemel.h: * impress/imposter.h: * impress/impress-document.c: * impress/impress-document.h: * impress/internal.h: * impress/r_back.c: * impress/r_draw.c: * impress/r_geometry.c: * impress/r_gradient.c: * impress/r_style.c: * impress/r_text.c: * impress/render.c: * impress/render.h: * impress/zip.c: * impress/zip.h: * lib/Makefile.am: * lib/ev-debug.c: * lib/ev-debug.h: * lib/ev-file-helpers.c: * lib/ev-file-helpers.h: * lib/ev-gui.c: * lib/ev-gui.h: * lib/ev-tooltip.c: * lib/ev-tooltip.h: * libdocument/Makefile.am: * libdocument/ev-file-helpers.c: * pdf/Makefile.am: * pdf/ev-poppler.cc: * pdf/ev-poppler.h: * pixbuf/Makefile.am: * pixbuf/pixbuf-document.c: * pixbuf/pixbuf-document.h: * properties/Makefile.am: * ps/Makefile.am: * ps/gsdefaults.c: * ps/gsdefaults.h: * ps/gsio.c: * ps/gsio.h: * ps/gstypes.h: * ps/ps-document.c: * ps/ps-document.h: * ps/ps.c: * ps/ps.h: * shell/Makefile.am: * shell/ev-application.h: * shell/ev-sidebar-links.c: * shell/ev-sidebar-links.h: * shell/ev-utils.c: (ev_gui_sanitise_popup_position), (ev_gui_menu_position_tree_selection): * shell/ev-utils.h: * shell/ev-view.c: (ev_view_finalize): * shell/ev-window.c: * shell/main.c: (main): * thumbnailer/Makefile.am: * tiff/Makefile.am: * tiff/tiff-document.c: * tiff/tiff-document.h: * tiff/tiff2ps.c: * tiff/tiff2ps.h: Reorganize source tree. svn path=/trunk/; revision=2197 --- (limited to 'dvi/mdvi-lib/mdvi.h') diff --git a/dvi/mdvi-lib/mdvi.h b/dvi/mdvi-lib/mdvi.h deleted file mode 100644 index 961689a..0000000 --- a/dvi/mdvi-lib/mdvi.h +++ /dev/null @@ -1,618 +0,0 @@ -/* - * Copyright (C) 2000, Matias Atria - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef _MDVI_DVI_H -#define _MDVI_DVI_H 1 - -#include -#include -#include - -#include "sysdeps.h" -#include "bitmap.h" -#include "common.h" -#include "defaults.h" -#include "dviopcodes.h" - -typedef struct _DviGlyph DviGlyph; -typedef struct _DviDevice DviDevice; -typedef struct _DviFontChar DviFontChar; -typedef struct _DviFontRef DviFontRef; -typedef struct _DviFontInfo DviFontInfo; -typedef struct _DviFont DviFont; -typedef struct _DviState DviState; -typedef struct _DviPageSpec *DviPageSpec; -typedef struct _DviParams DviParams; -typedef struct _DviBuffer DviBuffer; -typedef struct _DviContext DviContext; -typedef struct _DviRange DviRange; -typedef struct _DviColorPair DviColorPair; -typedef struct _DviSection DviSection; -typedef struct _TFMChar TFMChar; -typedef struct _TFMInfo TFMInfo; -typedef struct _DviFontSearch DviFontSearch; -/* this is an opaque type */ -typedef struct _DviFontClass DviFontClass; - -typedef void (*DviFreeFunc) __PROTO((void *)); -typedef void (*DviFree2Func) __PROTO((void *, void *)); - -typedef Ulong DviColor; - -#ifdef TRUE -#undef TRUE -#endif -#ifdef FALSE -#undef FALSE -#endif - -typedef enum { - FALSE = 0, - TRUE = 1 -} DviBool; - -#include "hash.h" -#include "paper.h" - -/* - * information about a page: - * pagenum[0] = offset to BOP - * pagenum[1], ..., pagenum[10] = TeX \counters - */ -typedef long PageNum[11]; - -/* this structure contains the platform-specific information - * required to interpret a DVI file */ - -typedef void (*DviGlyphDraw) __PROTO((DviContext *context, - DviFontChar *glyph, - int x, int y)); - -typedef void (*DviRuleDraw) __PROTO((DviContext *context, - int x, int y, - Uint width, Uint height, int fill)); - -typedef int (*DviColorScale) __PROTO((void *device_data, - Ulong *pixels, - int npixels, - Ulong foreground, - Ulong background, - double gamma, - int density)); -typedef void *(*DviCreateImage) __PROTO((void *device_data, - Uint width, - Uint height, - Uint bpp)); -typedef void (*DviFreeImage) __PROTO((void *image)); -typedef void (*DviPutPixel) __PROTO((void *image, int x, int y, Ulong color)); -typedef void (*DviDevDestroy) __PROTO((void *data)); -typedef void (*DviRefresh) __PROTO((DviContext *dvi, void *device_data)); -typedef void (*DviSetColor) __PROTO((void *device_data, Ulong, Ulong)); - -struct _DviDevice { - DviGlyphDraw draw_glyph; - DviRuleDraw draw_rule; - DviColorScale alloc_colors; - DviCreateImage create_image; - DviFreeImage free_image; - DviPutPixel put_pixel; - DviDevDestroy dev_destroy; - DviRefresh refresh; - DviSetColor set_color; - void * device_data; -}; - -/* - * Fonts - */ - -#include "fontmap.h" - -struct _TFMChar { - Int32 present; - Int32 advance; /* advance */ - Int32 height; /* ascent */ - Int32 depth; /* descent */ - Int32 left; /* leftSideBearing */ - Int32 right; /* rightSideBearing */ -}; - -struct _TFMInfo { - int type; /* DviFontAFM, DviFontTFM, DviFontOFM */ - Uint32 checksum; - Uint32 design; - int loc; - int hic; - char coding[64]; - char family[64]; - TFMChar *chars; -}; - -struct _DviGlyph { - short x, y; /* origin */ - Uint w, h; /* dimensions */ - void *data; /* bitmap or XImage */ -}; - -typedef void (*DviFontShrinkFunc) - __PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *)); -typedef int (*DviFontLoadFunc) __PROTO((DviParams *, DviFont *)); -typedef int (*DviFontGetGlyphFunc) __PROTO((DviParams *, DviFont *, int)); -typedef void (*DviFontFreeFunc) __PROTO((DviFont *)); -typedef void (*DviFontResetFunc) __PROTO((DviFont *)); -typedef char *(*DviFontLookupFunc) __PROTO((const char *, Ushort *, Ushort *)); -typedef int (*DviFontEncodeFunc) __PROTO((DviParams *, DviFont *, DviEncoding *)); - -struct _DviFontInfo { - char *name; /* human-readable format identifying string */ - int scalable; /* does it support scaling natively? */ - DviFontLoadFunc load; - DviFontGetGlyphFunc getglyph; - DviFontShrinkFunc shrink0; - DviFontShrinkFunc shrink1; - DviFontFreeFunc freedata; - DviFontResetFunc reset; - DviFontLookupFunc lookup; - int kpse_type; - void * private; -}; - -struct _DviFontChar { - Uint32 offset; - Int16 code; /* format-dependent, not used by MDVI */ - Int16 width; - Int16 height; - Int16 x; - Int16 y; - Int32 tfmwidth; - Ushort flags; -#ifdef __STRICT_ANSI__ - Ushort loaded; - Ushort missing; -#else - Ushort loaded : 1, - missing : 1; -#endif - Ulong fg; - Ulong bg; - BITMAP *glyph_data; - /* data for shrunk bitimaps */ - DviGlyph glyph; - DviGlyph shrunk; - DviGlyph grey; -}; - -struct _DviFontRef { - DviFontRef *next; - DviFont *ref; - Int32 fontid; -}; - -typedef enum { - DviFontAny = -1, - DviFontPK = 0, - DviFontGF = 1, - DviFontVF = 2, - DviFontTFM = 3, - DviFontT1 = 4, - DviFontTT = 5, - DviFontAFM = 6, - DviFontOFM = 7 -} DviFontType; - -struct _DviFontSearch { - int id; - Ushort hdpi; - Ushort vdpi; - Ushort actual_hdpi; - Ushort actual_vdpi; - const char *wanted_name; - const char *actual_name; - DviFontClass *curr; - DviFontInfo *info; -}; - -/* this is a kludge, I know */ -#define ISVIRTUAL(font) ((font)->search.info->getglyph == NULL) -#define SEARCH_DONE(s) ((s).id < 0) -#define SEARCH_INIT(s, name, h, v) do { \ - (s).id = 0; \ - (s).curr = NULL; \ - (s).hdpi = (h); \ - (s).vdpi = (v); \ - (s).wanted_name = (name); \ - (s).actual_name = NULL; \ - } while(0) - -struct _DviFont { - DviFont *next; - DviFont *prev; - int type; - Int32 checksum; - int hdpi; - int vdpi; - Int32 scale; - Int32 design; - FILE *in; - char *fontname; - char *filename; - int links; - int loc; - int hic; - Uint flags; - DviFontSearch search; - DviFontChar *chars; - DviFontRef *subfonts; - void *private; -}; - -/* - * Dvi context - */ - -typedef enum { - MDVI_ORIENT_TBLR = 0, /* top to bottom, left to right */ - MDVI_ORIENT_TBRL = 1, /* top to bottom, right to left */ - MDVI_ORIENT_BTLR = 2, /* bottom to top, left to right */ - MDVI_ORIENT_BTRL = 3, /* bottom to top, right to left */ - MDVI_ORIENT_RP90 = 4, /* rotated +90 degrees (counter-clockwise) */ - MDVI_ORIENT_RM90 = 5, /* rotated -90 degrees (clockwise) */ - MDVI_ORIENT_IRP90 = 6, /* flip horizontally, then rotate by +90 */ - MDVI_ORIENT_IRM90 = 7 /* rotate by -90, then flip horizontally */ -} DviOrientation; - -typedef enum { - MDVI_PAGE_SORT_UP, /* up, using \counter0 */ - MDVI_PAGE_SORT_DOWN, /* down, using \counter0 */ - MDVI_PAGE_SORT_RANDOM, /* randomly */ - MDVI_PAGE_SORT_DVI_UP, /* up, by location in DVI file */ - MDVI_PAGE_SORT_DVI_DOWN, /* down, by location in DVI file */ - MDVI_PAGE_SORT_NONE /* don't sort */ -} DviPageSort; - -struct _DviParams { - double mag; /* magnification */ - double conv; /* horizontal DVI -> pixel */ - double vconv; /* vertical DVI -> pixel */ - double tfm_conv; /* TFM -> DVI */ - double gamma; /* gamma correction factor */ - Uint dpi; /* horizontal resolution */ - Uint vdpi; /* vertical resolution */ - int hshrink; /* horizontal shrinking factor */ - int vshrink; /* vertical shrinking factor */ - Uint density; /* pixel density */ - Uint flags; /* flags (see MDVI_PARAM macros) */ - int hdrift; /* max. horizontal drift */ - int vdrift; /* max. vertical drift */ - int vsmallsp; /* small vertical space */ - int thinsp; /* small horizontal space */ - int layer; /* visible layer (for layered DVI files) */ - Ulong fg; /* foreground color */ - Ulong bg; /* background color */ - DviOrientation orientation; /* page orientation */ - int base_x; - int base_y; -}; - -typedef enum { - MDVI_PARAM_LAST = 0, - MDVI_SET_DPI = 1, - MDVI_SET_XDPI = 2, - MDVI_SET_YDPI = 3, - MDVI_SET_SHRINK = 4, - MDVI_SET_XSHRINK = 5, - MDVI_SET_YSHRINK = 6, - MDVI_SET_GAMMA = 7, - MDVI_SET_DENSITY = 8, - MDVI_SET_MAGNIFICATION = 9, - MDVI_SET_DRIFT = 10, - MDVI_SET_HDRIFT = 11, - MDVI_SET_VDRIFT = 12, - MDVI_SET_ORIENTATION = 13, - MDVI_SET_FOREGROUND = 14, - MDVI_SET_BACKGROUND = 15 -} DviParamCode; - -struct _DviBuffer { - Uchar *data; - size_t size; /* allocated size */ - size_t length; /* amount of data buffered */ - size_t pos; /* current position in buffer */ - int frozen; /* can we free this data? */ -}; - -/* DVI registers */ -struct _DviState { - int h; - int v; - int hh; - int vv; - int w; - int x; - int y; - int z; -}; - -struct _DviColorPair { - Ulong fg; - Ulong bg; -}; - -struct _DviContext { - char *filename; /* name of the DVI file */ - FILE *in; /* from here we read */ - char *fileid; /* from preamble */ - int npages; /* number of pages */ - int currpage; /* currrent page (0 based) */ - int depth; /* recursion depth */ - DviBuffer buffer; /* input buffer */ - DviParams params; /* parameters */ - DviPaper paper; /* paper type */ - Int32 num; /* numerator */ - Int32 den; /* denominator */ - DviFontRef *fonts; /* fonts used in this file */ - DviFontRef **fontmap; /* for faster id lookups */ - DviFontRef *currfont; /* current font */ - int nfonts; /* # of fonts used in this job */ - Int32 dvimag; /* original magnification */ - double dviconv; /* unshrunk scaling factor */ - double dvivconv; /* unshrunk scaling factor (vertical) */ - int dvi_page_w; /* unscaled page width */ - int dvi_page_h; /* unscaled page height */ - Ulong modtime; /* file modification time */ - PageNum *pagemap; /* page table */ - DviState pos; /* registers */ - DviPageSpec *pagesel; /* page selection data */ - int curr_layer; /* current layer */ - DviState *stack; /* DVI stack */ - int stacksize; /* stack depth */ - int stacktop; /* stack pointer */ - DviDevice device; /* device-specific routines */ - Ulong curr_fg; /* rendering color */ - Ulong curr_bg; - - DviColorPair *color_stack; - int color_top; - int color_size; - - DviFontRef *(*findref) __PROTO((DviContext *, Int32)); - void *user_data; /* client data attached to this context */ -}; - -typedef enum { - MDVI_RANGE_BOUNDED, /* range is finite */ - MDVI_RANGE_LOWER, /* range has a lower bound */ - MDVI_RANGE_UPPER, /* range has an upper bound */ - MDVI_RANGE_UNBOUNDED /* range has no bounds at all */ -} DviRangeType; - -struct _DviRange { - DviRangeType type; /* one of the above */ - int from; /* lower bound */ - int to; /* upper bound */ - int step; /* step */ -}; - - -typedef void (*DviSpecialHandler) - __PROTO((DviContext *dvi, const char *prefix, const char *arg)); - -#define RANGE_HAS_LOWER(x) \ - ((x) == MDVI_RANGE_BOUNDED || (x) == MDVI_RANGE_LOWER) -#define RANGE_HAS_UPPER(x) \ - ((x) == MDVI_RANGE_BOUNDED || (x) == MDVI_RANGE_UPPER) - -/* - * Macros and prototypes - */ - -#define MDVI_PARAM_ANTIALIASED 1 -#define MDVI_PARAM_MONO 2 -#define MDVI_PARAM_CHARBOXES 4 -#define MDVI_PARAM_SHOWUNDEF 8 -#define MDVI_PARAM_DELAYFONTS 16 - -/* - * The FALLBACK priority class is reserved for font formats that - * contain no glyph information and are to be used as a last - * resort (e.g. TFM, AFM) - */ -#define MDVI_FONTPRIO_FALLBACK -3 -#define MDVI_FONTPRIO_LOWEST -2 -#define MDVI_FONTPRIO_LOW -1 -#define MDVI_FONTPRIO_NORMAL 0 -#define MDVI_FONTPRIO_HIGH 1 -#define MDVI_FONTPRIO_HIGHEST 2 - -#define MDVI_FONT_ENCODED (1 << 0) - -#define MDVI_GLYPH_EMPTY ((void *)1) -/* does the glyph have a non-empty bitmap/image? */ -#define MDVI_GLYPH_NONEMPTY(x) ((x) && (x) != MDVI_GLYPH_EMPTY) -/* has the glyph been loaded from disk? */ -#define MDVI_GLYPH_UNSET(x) ((x) == NULL) -/* do we have only a bounding box for this glyph? */ -#define MDVI_GLYPH_ISEMPTY(x) ((x) == MDVI_GLYPH_EMPTY) - -#define MDVI_ENABLED(d,x) ((d)->params.flags & (x)) -#define MDVI_DISABLED(d,x) !MDVI_ENABLED((d), (x)) - -#define MDVI_LASTPAGE(d) ((d)->npages - 1) -#define MDVI_NPAGES(d) (d)->npages -#define MDVI_VALIDPAGE(d,p) ((p) >= 0 && (p) <= MDVI_LASTPAGE(d)) -#define MDVI_FLAGS(d) (d)->params.flags -#define MDVI_SHRINK_FROM_DPI(d) Max(1, (d) / 75) -#define MDVI_CURRFG(d) (d)->curr_fg -#define MDVI_CURRBG(d) (d)->curr_bg - -#define pixel_round(d,v) (int)((d)->params.conv * (v) + 0.5) -#define vpixel_round(d,v) (int)((d)->params.vconv * (v) + 0.5) -#define rule_round(d,v) (int)((d)->params.conv * (v) + 0.99999) /*9999999)*/ -#define vrule_round(d,v) (int)((d)->params.vconv * (v) + 0.99999) - -extern int mdvi_reload __PROTO((DviContext *, DviParams *)); -extern void mdvi_setpage __PROTO((DviContext *, int)); -extern int mdvi_dopage __PROTO((DviContext *, int)); -extern void mdvi_shrink_glyph __PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *)); -extern void mdvi_shrink_box __PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *)); -extern void mdvi_shrink_glyph_grey __PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *)); -extern int mdvi_find_tex_page __PROTO((DviContext *, int)); -extern int mdvi_configure __PROTO((DviContext *, DviParamCode, ...)); - -extern int get_tfm_chars __PROTO((DviParams *, DviFont *, TFMInfo *, int)); -extern int tfm_load_file __PROTO((const char *, TFMInfo *)); -extern int afm_load_file __PROTO((const char *, TFMInfo *)); -extern TFMInfo *get_font_metrics __PROTO((const char *, int, const char *)); -extern char *lookup_font_metrics __PROTO((const char *, int *)); -extern void free_font_metrics __PROTO((TFMInfo *)); -extern void flush_font_metrics __PROTO((void)); - -#define get_metrics(name) get_font_metrics((name), DviFontAny, NULL) - -extern void mdvi_sort_pages __PROTO((DviContext *, DviPageSort)); - -extern void mdvi_init_kpathsea __PROTO((const char *, const char *, const char *, int)); - -extern DviContext* mdvi_init_context __PROTO((DviParams *, DviPageSpec *, const char *)); -extern void mdvi_destroy_context __PROTO((DviContext *)); - -/* helper macros that call mdvi_configure() */ -#define mdvi_config_one(d,x,y) mdvi_configure((d), (x), (y), MDVI_PARAM_LAST) -#define mdvi_set_dpi(d,x) mdvi_config_one((d), MDVI_SET_DPI, (x)) -#define mdvi_set_xdpi(d,x) mdvi_config_one((d), MDVI_SET_XDPI, (x)) -#define mdvi_set_ydpi(d,x) mdvi_config_one((d), MDVI_SET_YDPI, (x)) -#define mdvi_set_hshrink(d,h) mdvi_config_one((d), MDVI_SET_XSHRINK, (h)) -#define mdvi_set_vshrink(d,h) mdvi_config_one((d), MDVI_SET_YSHRINK, (h)) -#define mdvi_set_gamma(d,g) mdvi_config_one((d), MDVI_SET_GAMMA, (g)) -#define mdvi_set_density(d,x) mdvi_config_one((d), MDVI_SET_DENSITY, (x)) -#define mdvi_set_drift(d,x) mdvi_config_one((d), MDVI_SET_DRIFT, (x)) -#define mdvi_set_hdrift(d,h) mdvi_config_one((d), MDVI_SET_HDRIFT, (h)) -#define mdvi_set_vdrift(d,v) mdvi_config_one((d), MDVI_SET_VDRIFT, (v)) -#define mdvi_set_mag(d,m) \ - mdvi_config_one((d), MDVI_SET_MAGNIFICATION, (m)) -#define mdvi_set_foreground(d,x) \ - mdvi_config_one((d), MDVI_SET_FOREGROUND, (x)) -#define mdvi_set_background(d,x) \ - mdvi_config_one((d), MDVI_SET_BACKGROUND, (x)) -#define mdvi_set_orientation(d,x) \ - mdvi_config_one((d), MDVI_SET_ORIENTATION, (x)) -#define mdvi_set_shrink(d,h,v) \ - mdvi_configure((d), MDVI_SET_XSHRINK, (h), \ - MDVI_SET_YSHRINK, (v), MDVI_PARAM_LAST) - -extern DviRange* mdvi_parse_range __PROTO((const char *, DviRange *, int *, char **)); -extern DviPageSpec* mdvi_parse_page_spec __PROTO((const char *)); -extern void mdvi_free_page_spec __PROTO((DviPageSpec *)); -extern int mdvi_in_range __PROTO((DviRange *, int, int)); -extern int mdvi_range_length __PROTO((DviRange *, int)); -extern int mdvi_page_selected __PROTO((DviPageSpec *, PageNum, int)); - -/* Specials */ -extern int mdvi_register_special __PROTO(( - const char *label, - const char *prefix, - const char *regex, - DviSpecialHandler handler, - int replace)); -extern int mdvi_unregister_special __PROTO((const char *prefix)); -extern int mdvi_do_special __PROTO((DviContext *dvi, char *dvi_special)); -extern void mdvi_flush_specials __PROTO((void)); - -/* Fonts */ - -#define MDVI_FONTSEL_BITMAP (1 << 0) -#define MDVI_FONTSEL_GREY (1 << 1) -#define MDVI_FONTSEL_GLYPH (1 << 2) - -#define FONTCHAR(font, code) \ - (((code) < font->loc || (code) > font->hic || !(font)->chars) ? \ - NULL : &font->chars[(code) - (font)->loc]) -#define FONT_GLYPH_COUNT(font) ((font)->hic - (font)->loc + 1) - -#define glyph_present(x) ((x) && (x)->offset) - -/* create a reference to a font */ -extern DviFontRef *font_reference __PROTO((DviParams *params, - Int32 dvi_id, - const char *font_name, - Int32 checksum, - int xdpi, - int ydpi, - Int32 scale_factor)); - -/* drop a reference to a font */ -extern void font_drop_one __PROTO((DviFontRef *)); - -/* drop a chain of references */ -extern void font_drop_chain __PROTO((DviFontRef *)); - -/* destroy selected information for a glyph */ -extern void font_reset_one_glyph __PROTO((DviDevice *, DviFontChar *, int)); - -/* destroy selected information for all glyphs in a font */ -extern void font_reset_font_glyphs __PROTO((DviDevice *, DviFont *, int)); - -/* same for a chain of font references */ -extern void font_reset_chain_glyphs __PROTO((DviDevice *, DviFontRef *, int)); - -extern void font_finish_definitions __PROTO((DviContext *)); - -/* lookup an id # in a reference chain */ -extern DviFontRef* font_find_flat __PROTO((DviContext *, Int32)); -extern DviFontRef* font_find_mapped __PROTO((DviContext *, Int32)); - -/* called to reopen (or rewind) a font file */ -extern int font_reopen __PROTO((DviFont *)); - -/* reads a glyph from a font, and makes all necessary transformations */ -extern DviFontChar* font_get_glyph __PROTO((DviContext *, DviFont *, int)); - -/* transform a glyph according to the given orientation */ -extern void font_transform_glyph __PROTO((DviOrientation, DviGlyph *)); - -/* destroy all fonts that are not being used, returns number of fonts freed */ -extern int font_free_unused __PROTO((DviDevice *)); - -#define font_free_glyph(dev, font, code) \ - font_reset_one_glyph((dev), \ - FONTCHAR((font), (code)), MDVI_FONTSEL_GLYPH) - -extern int mdvi_encode_font __PROTO((DviParams *, DviFont *)); - - -/* font lookup functions */ -extern int mdvi_register_font_type __PROTO((DviFontInfo *, int)); -extern char **mdvi_list_font_class __PROTO((int)); -extern int mdvi_get_font_classes __PROTO((void)); -extern int mdvi_unregister_font_type __PROTO((const char *, int)); -extern char *mdvi_lookup_font __PROTO((DviFontSearch *)); -extern DviFont *mdvi_add_font __PROTO((const char *, Int32, int, int, Int32)); -extern int mdvi_font_retry __PROTO((DviParams *, DviFont *)); - -/* Miscellaneous */ - -extern int mdvi_set_logfile __PROTO((const char *)); -extern int mdvi_set_logstream __PROTO((FILE *)); -extern int mdvi_set_loglevel __PROTO((int)); - -#define mdvi_stop_logging(x) mdvi_set_logstream(NULL) - -/* this will check the environment and then `texmf.cnf' for - * the given name changed to lowercase, and `_' changed to `-' */ -extern char* mdvi_getenv __PROTO((const char *)); - -#endif /* _MDVI_DVI_H */ -- cgit v0.9.1