Land XPRINT branch on XORG-CURRENT
This commit is contained in:
parent
449e83a947
commit
1af13123fa
|
@ -28,6 +28,13 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
#Augment_Printer_List %none%
|
#Augment_Printer_List %none%
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Preconfigured entry for the PSspooldir model
|
||||||
|
# (which sends jobs to /tmp/Xprintjobs instead to a physical printer)
|
||||||
|
########################################################################
|
||||||
|
#Printer xp_pdf_spooldir_tmp_Xprintjobs
|
||||||
|
Printer xp_ps_spooldir_tmp_Xprintjobs
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Add individual printers to the list of printers managed by the
|
# Add individual printers to the list of printers managed by the
|
||||||
# server. These are aliases, determined by driver name.
|
# server. These are aliases, determined by driver name.
|
||||||
|
@ -40,4 +47,3 @@
|
||||||
# Printer xppclpr
|
# Printer xppclpr
|
||||||
# Printer xppclmonopr
|
# Printer xppclmonopr
|
||||||
# Printer xprasterpr
|
# Printer xprasterpr
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,17 @@
|
||||||
*copy-count: 1
|
*copy-count: 1
|
||||||
*default-medium: iso-a4
|
*default-medium: iso-a4
|
||||||
*default-printer-resolution: 300
|
*default-printer-resolution: 300
|
||||||
*document-format: {Postscript 2}
|
|
||||||
*plex: duplex
|
|
||||||
|
|
||||||
|
# "PSspooldir" jobs should always be 300 DPI
|
||||||
|
# (to be compatible to DPS-based PostScript viewers such as sdtimage)
|
||||||
|
PSspooldir.default-printer-resolution: 300
|
||||||
|
|
||||||
|
# "PS2PDFspooldir-GS" jobs should always be 600 DPI
|
||||||
|
PS2PDFspooldir-GS.default-printer-resolution: 600
|
||||||
|
|
||||||
|
# Some resolution defaults to make applications happy which are too lazy
|
||||||
|
# to pick an own default in absence of "default-printer-resolution"
|
||||||
|
HPLJ4050-PS.default-printer-resolution: 600
|
||||||
|
|
||||||
# EXAMPLES
|
# EXAMPLES
|
||||||
#
|
#
|
||||||
|
|
|
@ -16,8 +16,24 @@
|
||||||
# Set this attribute for all printers.
|
# Set this attribute for all printers.
|
||||||
# Example: "*.document-formats-ready: {pcl 5}"
|
# Example: "*.document-formats-ready: {pcl 5}"
|
||||||
|
|
||||||
|
# Remove this line and replace them with per printer settings
|
||||||
|
# if you want to use more than one DDX!!
|
||||||
|
*xp-model-identifier: PSdefault
|
||||||
|
|
||||||
*xp-ddx-identifier: XP-POSTSCRIPT
|
|
||||||
|
# Sample entry for the "PSspooldir" model
|
||||||
|
# Just add a printer called "xp_ps_spooldir_tmp_Xprintjobs" to "Xprinters"
|
||||||
|
# and you will get an extra printer which files the PostScript jobs
|
||||||
|
# in the "/tmp/Xprintjobs/" directory.
|
||||||
|
xp_ps_spooldir_tmp_Xprintjobs.xp-model-identifier: PSspooldir
|
||||||
|
|
||||||
|
# Sample entry for the "PS2PDFspooldir-GS" model
|
||||||
|
# Just add a printer called "xp_pdf_spooldir_tmp_Xprintjobs" to "Xprinters"
|
||||||
|
# and you will get an extra printer which convertes the PostScript jobs
|
||||||
|
# to PDF using "ps2pdf" and files them into the "/tmp/Xprintjobs/" directory.
|
||||||
|
# NOTE: Future versions of Xprint will use the PDF DDX instead directly
|
||||||
|
# instead of relying on GhostScript/ps2pdf...
|
||||||
|
xp_pdf_spooldir_tmp_Xprintjobs.xp-model-identifier: PS2PDFspooldir-GS
|
||||||
|
|
||||||
|
|
||||||
# IMPORTANT EXAMPLES
|
# IMPORTANT EXAMPLES
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# $Xprint.org: CANONBJ10E-GS model-config,v 1.4 2003/02/10 14:48:04 gisburn Exp $
|
||||||
|
|
||||||
|
*content-orientations-supported: portrait landscape
|
||||||
|
*descriptor: Canon BJ-10e (GhostScript)
|
||||||
|
*document-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*input-trays-supported:
|
||||||
|
*medium-source-sizes-supported: \
|
||||||
|
{ '' \
|
||||||
|
{iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
|
||||||
|
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
|
||||||
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{na-legal FALSE {6.35 209.55 6.35 349.25}}\
|
||||||
|
}
|
||||||
|
|
||||||
|
*plexes-supported: simplex
|
||||||
|
*printer-model: "Canon BJ-10e (GhostScript)"
|
||||||
|
*printer-resolutions-supported: 360
|
||||||
|
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-raw-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
# EOF.
|
|
@ -0,0 +1,137 @@
|
||||||
|
# $Xprint.org: GSdefault model-config,v 1.1 2003/02/10 14:48:04 gisburn Exp $
|
||||||
|
# Generic default model-config for the PostScript DDX when using GhostScript
|
||||||
|
# as printer driver
|
||||||
|
#
|
||||||
|
# DO NOT MODIFY THIS FILE!!
|
||||||
|
#
|
||||||
|
# If you want to make customisations for your printer create a copy
|
||||||
|
# of this printer model.
|
||||||
|
# Example (for creating a model config "MYCOMPANYlaserxx"):
|
||||||
|
# 1. Create model config dir:
|
||||||
|
# % mkdir MYCOMPANYlaserxx
|
||||||
|
# 2. Link (or copy) the PMF (printer font metrics) for the
|
||||||
|
# printer buildin fonts:
|
||||||
|
# % ln -s GSdefault/fonts MYCOMPANYlaserxx/.
|
||||||
|
# 3. Copy the model config file:
|
||||||
|
# % cp GSdefault/model-config MYCOMPANYlaserxx/.
|
||||||
|
# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Attributes supported for this printer model
|
||||||
|
# You may want to cut the lists here down to the attributes supported
|
||||||
|
# by your printer.
|
||||||
|
*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
|
||||||
|
*descriptor: GhostScript default model
|
||||||
|
*document-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*input-trays-supported:
|
||||||
|
*medium-source-sizes-supported: \
|
||||||
|
{ '' \
|
||||||
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{na-legal FALSE {6.35 209.55 6.35 349.25}}\
|
||||||
|
{executive FALSE {6.35 177.80 6.35 260.35}}\
|
||||||
|
{folio FALSE {6.35 204.47 6.35 323.85}}\
|
||||||
|
{invoice FALSE {6.35 133.35 6.35 209.55}}\
|
||||||
|
{ledger FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{quarto FALSE {6.35 209.55 6.35 268.732}}\
|
||||||
|
{a FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{b FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{c FALSE {6.35 425.45 6.35 552.45}}\
|
||||||
|
{d FALSE {6.35 552.45 6.35 857.25}}\
|
||||||
|
{e FALSE {6.35 857.25 6.35 1111.25}}\
|
||||||
|
{na-6x9-envelope FALSE {6.35 146.05 6.35 222.25}}\
|
||||||
|
{na-10x15-envelope FALSE {6.35 247.65 6.35 374.65}}\
|
||||||
|
{monarch-envelope FALSE {6.35 91.948 6.35 184.15}}\
|
||||||
|
{na-10x13-envelope FALSE {6.35 247.65 6.35 323.85}}\
|
||||||
|
{na-9x12-envelope FALSE {6.35 222.25 6.35 298.45}}\
|
||||||
|
{na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}}\
|
||||||
|
{na-7x9-envelope FALSE {6.35 171.45 6.35 222.25}}\
|
||||||
|
{na-9x11-envelope FALSE {6.35 222.25 6.35 273.05}}\
|
||||||
|
{na-10x14-envelope FALSE {6.35 247.65 6.35 349.25}}\
|
||||||
|
{na-number-9-envelope FALSE {6.35 92.075 6.35 219.075}}\
|
||||||
|
{iso-a0 FALSE {6.35 834.65 6.35 1182.65}}\
|
||||||
|
{iso-a1 FALSE {6.35 587.65 6.35 834.65}}\
|
||||||
|
{iso-a2 FALSE {6.35 413.65 6.35 587.65}}\
|
||||||
|
{iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
|
||||||
|
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
|
||||||
|
{iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
|
||||||
|
{iso-a6 FALSE {6.35 98.65 6.35 141.65}}\
|
||||||
|
{iso-a7 FALSE {6.35 67.65 6.35 98.65}}\
|
||||||
|
{iso-a8 FALSE {6.35 45.65 6.35 67.65}}\
|
||||||
|
{iso-a9 FALSE {6.35 30.65 6.35 45.65}}\
|
||||||
|
{iso-a10 FALSE {6.35 19.65 6.35 30.65}}\
|
||||||
|
{iso-b1 FALSE {6.35 700.65 6.35 993.65}}\
|
||||||
|
{iso-b2 FALSE {6.35 493.65 6.35 700.65}}\
|
||||||
|
{iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
|
||||||
|
{iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
|
||||||
|
{iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
|
||||||
|
{iso-b6 FALSE {6.35 118.65 6.35 169.65}}\
|
||||||
|
{iso-b7 FALSE {6.35 81.65 6.35 118.65}}\
|
||||||
|
{iso-b8 FALSE {6.35 55.65 6.35 81.65}}\
|
||||||
|
{iso-b9 FALSE {6.35 37.65 6.35 55.65}}\
|
||||||
|
{iso-b10 FALSE {6.35 24.65 6.35 37.65}}\
|
||||||
|
{jis-b1 FALSE {6.35 721.65 6.35 1023.65}}\
|
||||||
|
{jis-b2 FALSE {6.35 508.65 6.35 721.65}}\
|
||||||
|
{jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
|
||||||
|
{jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
|
||||||
|
{jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
|
||||||
|
{jis-b6 FALSE {6.35 121.65 6.35 175.65}}\
|
||||||
|
{jis-b7 FALSE {6.35 84.65 6.35 121.65}}\
|
||||||
|
{jis-b8 FALSE {6.35 57.65 6.35 84.65}}\
|
||||||
|
{jis-b9 FALSE {6.35 38.65 6.35 57.65}}\
|
||||||
|
{jis-b10 FALSE {6.35 25.65 6.35 38.65}}\
|
||||||
|
{iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
|
||||||
|
{iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
|
||||||
|
{iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
|
||||||
|
{iso-c6 FALSE {6.35 107.65 6.35 155.65}}\
|
||||||
|
{iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
|
||||||
|
{hp-2x-postcard FALSE {6.35 141.65 6.35 193.65}}\
|
||||||
|
{hp-european-edp FALSE {6.35 298.45 6.35 349.25}}\
|
||||||
|
{hp-mini FALSE {6.35 133.35 6.35 209.55}}\
|
||||||
|
{hp-postcard FALSE {6.35 93.65 6.35 141.65}}\
|
||||||
|
{hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{hp-us-edp FALSE {6.35 273.05 6.35 349.25}}\
|
||||||
|
{hp-us-government-legal FALSE {6.35 196.85 6.35 323.85}}\
|
||||||
|
{hp-us-government-letter FALSE {6.35 196.85 6.35 247.65}}\
|
||||||
|
}
|
||||||
|
# If you have more than one tray use the following example:
|
||||||
|
# 1. List the supported trays
|
||||||
|
#*input-trays-supported: main manual
|
||||||
|
# 2. Define each tray and it's paper sizes
|
||||||
|
#*medium-source-sizes-supported: \
|
||||||
|
#{ main \
|
||||||
|
# {na-letter FALSE {6.35 209.55 6.35 273.05}} \
|
||||||
|
# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
|
||||||
|
# {iso-a4 FALSE {6.35 203.65 6.35 290.65}} \
|
||||||
|
#} \
|
||||||
|
#{ manual \
|
||||||
|
# {iso-a5 FALSE {6.35 141.65 6.35 203.65}} \
|
||||||
|
# {iso-c5 FALSE {6.35 155.65 6.35 222.65}} \
|
||||||
|
# {iso-designated-long FALSE {6.35 103.65 6.35 213.65}} \
|
||||||
|
# {jis-b5 FALSE {6.35 175.65 6.35 250.65}} \
|
||||||
|
# {monarch-envelope FALSE {6.35 91.948 6.35 184.15}} \
|
||||||
|
# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
|
||||||
|
# {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}} \
|
||||||
|
# {executive FALSE {6.35 177.8 6.35 260.35}} \
|
||||||
|
# {iso-a3 FALSE {6.35 290.65 6.35 413.65}} \
|
||||||
|
# {iso-a0 FALSE {6.35 834.65 6.35 1182.65}} \
|
||||||
|
#}
|
||||||
|
*plexes-supported: simplex duplex tumble
|
||||||
|
*printer-model: "GhostScript default model"
|
||||||
|
# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
|
||||||
|
# 940, 1200 and 2440 are supported DPI values, we limit it here
|
||||||
|
# to some common values:
|
||||||
|
*printer-resolutions-supported: 300 360 400 600
|
||||||
|
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-raw-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
|
||||||
|
# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
|
||||||
|
# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
|
||||||
|
# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
|
||||||
|
*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
|
||||||
|
# xp-psddx-download-font-type defines which font type is used to download outlines
|
||||||
|
# (valid values are "bitmap", "pstype1" and "pstype3")
|
||||||
|
*xp-psddx-download-font-type: pstype1
|
||||||
|
# EOF.
|
|
@ -1 +0,0 @@
|
||||||
! So the file isn't empty
|
|
|
@ -1,28 +1,16 @@
|
||||||
# $Xorg: model-config,v 1.3 2000/08/17 19:48:04 cpqbld Exp $
|
# $Xprint.org: HPDJ1600C model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $
|
||||||
# This is the configuration file for the HP DeskJet 1600C printer.
|
# This is the configuration file for the HP DeskJet 1600C printer.
|
||||||
#
|
#
|
||||||
# The CDEnext SI supports two 1600C drivers XP-PCL-MONO and
|
# The CDEnext SI supports two 1600C drivers XP-PCL-MONO and
|
||||||
# XP-PCL-COLOR, which work with this configuration file.
|
# XP-PCL-COLOR, which work with this configuration file.
|
||||||
#
|
#
|
||||||
# Attribute IDs must be qualified using either the printer-model
|
|
||||||
# identifier or an asterisk ('*'). For example, if "HPDJ1600C" is the
|
|
||||||
# printer-model, then to initialize the 'plexes-supported' attribute
|
|
||||||
# to 'simplex', use: "HPDJ1600C.plexes-supported: simplex". For the
|
|
||||||
# asterisk, use: "*.plexes-supported: simplex". If the same attribute
|
|
||||||
# is specified using each method, the printer-model qualified entry
|
|
||||||
# takes precedence.
|
|
||||||
|
|
||||||
HPDJ1600C.printer-model: "Hewlett-Packard DeskJet 1600C"
|
|
||||||
HPDJ1600C.printer-resolutions-supported: 300
|
|
||||||
HPDJ1600C.content-orientations-supported: portrait landscape
|
|
||||||
HPDJ1600C.document-formats-supported: {PCL 5} {PostScript 2}
|
|
||||||
HPDJ1600C.plexes-supported: simplex duplex
|
|
||||||
HPDJ1600C.xp-ddx-identifier: XP-PCL-COLOR
|
|
||||||
HPDJ1600C.xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
|
|
||||||
HPDJ1600C.xp-setup-proviso: setup-optional
|
|
||||||
|
|
||||||
|
*content-orientations-supported: portrait landscape
|
||||||
|
*descriptor: Hewlett-Packard DeskJet 1600C
|
||||||
|
*document-formats-supported: {PCL 5} {PostScript 2}
|
||||||
|
*input-trays-supported:
|
||||||
# 1/4" unprintable margins
|
# 1/4" unprintable margins
|
||||||
HPDJ1600C.medium-source-sizes-supported:\
|
*medium-source-sizes-supported:\
|
||||||
{ '' \
|
{ '' \
|
||||||
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
{executive FALSE {6.35 177.75 6.35 260.35}}\
|
{executive FALSE {6.35 177.75 6.35 260.35}}\
|
||||||
|
@ -41,4 +29,12 @@ HPDJ1600C.medium-source-sizes-supported:\
|
||||||
{hp-japanese-postcard FALSE {6 94 6 142 }}\
|
{hp-japanese-postcard FALSE {6 94 6 142 }}\
|
||||||
{hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
|
{hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
|
||||||
}
|
}
|
||||||
|
*plexes-supported: simplex duplex
|
||||||
|
*printer-model: "Hewlett-Packard DeskJet 1600C"
|
||||||
|
*printer-resolutions-supported: 300
|
||||||
|
*xp-ddx-identifier: XP-PCL-COLOR
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
|
||||||
|
*xp-raw-formats-supported: { PCL 5 }
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
# EOF.
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
# $Xprint.org: HPLJ4050-PS model-config,v 1.1 2003/12/16 00:48:04 gisburn Exp $
|
||||||
|
# model-config for the HP LaserJet 4050 PostScript printer series
|
||||||
|
#
|
||||||
|
*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
|
||||||
|
*descriptor: Hewlett-Packard LaserJet 4050 PostScript printer
|
||||||
|
*document-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*input-trays-supported:
|
||||||
|
*medium-source-sizes-supported: \
|
||||||
|
{ '' \
|
||||||
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{na-legal FALSE {6.35 209.55 6.35 349.25}}\
|
||||||
|
{executive FALSE {6.35 177.80 6.35 260.35}}\
|
||||||
|
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
|
||||||
|
{iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
|
||||||
|
{iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
|
||||||
|
{jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
|
||||||
|
}
|
||||||
|
|
||||||
|
# Duplex unit is optional for HPLJ4050 series
|
||||||
|
*plexes-supported: simplex
|
||||||
|
*printer-model: "Hewlett-Packard LaserJet 4050 PostScript printer"
|
||||||
|
*printer-resolutions-supported: 600 1200
|
||||||
|
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-raw-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
|
||||||
|
# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
|
||||||
|
# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
|
||||||
|
# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
|
||||||
|
*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
|
||||||
|
# xp-psddx-download-font-type defines which font type is used to download outlines
|
||||||
|
# (valid values are "bitmap", "pstype1" and "pstype3")
|
||||||
|
*xp-psddx-download-font-type: pstype1
|
||||||
|
# EOF.
|
|
@ -1 +0,0 @@
|
||||||
! So the file isn't empty
|
|
|
@ -1,28 +1,15 @@
|
||||||
# $Xorg: model-config,v 1.3 2000/08/17 19:48:04 cpqbld Exp $
|
# $Xprint.org: HPLJ4family model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $
|
||||||
# This is the configuration file for the HP LaserJet 4 Printers.
|
# This is the configuration file for the HP LaserJet 4 Printers.
|
||||||
#
|
#
|
||||||
# Though not a deliverable for the CDEnext SI, the XP-PCL-MONO
|
# Though not a deliverable for the CDEnext SI, the XP-PCL-MONO
|
||||||
# driver should be able to support the LaserJet 4 printers.
|
# driver should be able to support the LaserJet 4 printers.
|
||||||
#
|
#
|
||||||
# Attribute IDs must be qualified using either the printer-model
|
*content-orientations-supported: portrait landscape
|
||||||
# identifier or an asterisk ('*'). For example, if "HPLJ4family" is the
|
*descriptor: Hewlett-Packard LaserJet 4 Series
|
||||||
# printer-model, then to initialize the 'plexes-supported' attribute
|
*document-formats-supported: {PCL 5} {PostScript 2}
|
||||||
# to 'simplex', use: "HPLJ4family.plexes-supported: simplex". For the
|
*input-trays-supported:
|
||||||
# asterisk, use: "*.plexes-supported: simplex". If the same attribute
|
|
||||||
# is specified using each method, the printer-model qualified entry
|
|
||||||
# takes precedence.
|
|
||||||
|
|
||||||
HPLJ4family.printer-model: "Hewlett-Packard LaserJet 4 Series"
|
|
||||||
HPLJ4family.printer-resolutions-supported: 300 600
|
|
||||||
HPLJ4family.content-orientations-supported: portrait landscape
|
|
||||||
HPLJ4family.document-formats-supported: {PCL 5} {PostScript 2}
|
|
||||||
HPLJ4family.plexes-supported: simplex duplex
|
|
||||||
HPLJ4family.xp-ddx-identifier: XP-PCL-MONO
|
|
||||||
HPLJ4family.xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
|
|
||||||
HPLJ4family.xp-setup-proviso: setup-optional
|
|
||||||
|
|
||||||
# 1/4" unprintable margins
|
# 1/4" unprintable margins
|
||||||
HPLJ4family.medium-source-sizes-supported:\
|
*medium-source-sizes-supported:\
|
||||||
{ '' \
|
{ '' \
|
||||||
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
{executive FALSE {6.35 177.75 6.35 260.35}}\
|
{executive FALSE {6.35 177.75 6.35 260.35}}\
|
||||||
|
@ -41,4 +28,12 @@ HPLJ4family.medium-source-sizes-supported:\
|
||||||
{hp-japanese-postcard FALSE {6 94 6 142 }}\
|
{hp-japanese-postcard FALSE {6 94 6 142 }}\
|
||||||
{hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
|
{hp-japanese-doublepostcard FALSE {6 142 6 194 }}\
|
||||||
}
|
}
|
||||||
|
*plexes-supported: simplex duplex
|
||||||
|
*printer-model: "Hewlett-Packard LaserJet 4 Series"
|
||||||
|
*printer-resolutions-supported: 300 600
|
||||||
|
*xp-ddx-identifier: XP-PCL-MONO
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: { PCL 5 } { PostScript 2 }
|
||||||
|
*xp-raw-formats-supported: { PCL 5 }
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
# EOF.
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
# $Xprint.org: PS2PDFspooldir-GS model-config,v 1.1 2003/11/20 03:48:04 gisburn Exp $
|
||||||
|
# PostScript DDX model-config which converts jobs to PDF via GhostScript's "ps2pdf"
|
||||||
|
# and then sends them to a spool dir instead to a print queue
|
||||||
|
#
|
||||||
|
# This model is basically a cut-down GSdefault model with a custom *xp-spooler-command
|
||||||
|
#
|
||||||
|
# DO NOT MODIFY THIS FILE!!
|
||||||
|
#
|
||||||
|
# If you want to make customisations for your printer create a copy
|
||||||
|
# of this printer model.
|
||||||
|
# Example (for creating a model config "MYCOMPANYlaserxx"):
|
||||||
|
# 1. Create model config dir:
|
||||||
|
# % mkdir MYCOMPANYlaserxx
|
||||||
|
# 2. Link (or copy) the PMF (printer font metrics) for the
|
||||||
|
# printer buildin fonts:
|
||||||
|
# % ln -s PS2PDFspooldir-GS/fonts MYCOMPANYlaserxx/.
|
||||||
|
# 3. Copy the model config file:
|
||||||
|
# % cp PS2PDFspooldir-GS/model-config MYCOMPANYlaserxx/.
|
||||||
|
# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
|
||||||
|
#
|
||||||
|
# Attributes supported for this printer model
|
||||||
|
*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
|
||||||
|
*descriptor: PDF job spool dir /tmp/Xprintjobs
|
||||||
|
*document-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*input-trays-supported:
|
||||||
|
*medium-source-sizes-supported: \
|
||||||
|
{ '' \
|
||||||
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{na-legal FALSE {6.35 209.55 6.35 349.25}}\
|
||||||
|
{executive FALSE {6.35 177.80 6.35 260.35}}\
|
||||||
|
{ledger FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{quarto FALSE {6.35 209.55 6.35 268.732}}\
|
||||||
|
{iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
|
||||||
|
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
|
||||||
|
{iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
|
||||||
|
{iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
|
||||||
|
{iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
|
||||||
|
{iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
|
||||||
|
{jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
|
||||||
|
{jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
|
||||||
|
{jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
|
||||||
|
{iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
|
||||||
|
{iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
|
||||||
|
{iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
|
||||||
|
}
|
||||||
|
|
||||||
|
*plexes-supported: simplex duplex tumble
|
||||||
|
*printer-model: "PDF job spool dir /tmp/Xprintjobs"
|
||||||
|
# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
|
||||||
|
# 940, 1200 and 2440 are supported DPI values, we limit it here
|
||||||
|
# to some common values:
|
||||||
|
*printer-resolutions-supported: 300 360 400 600
|
||||||
|
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-raw-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
|
||||||
|
# Use custom spooler script which sends the output to a dir instead to a printer queue
|
||||||
|
# Note that "%xpconfigdir%" is currently only supported in Xprt servers build
|
||||||
|
# from xprint.mozdev.org sources, other platforms have replace it with the
|
||||||
|
# absolute path name to the script
|
||||||
|
*xp-spooler-command: %xpconfigdir%/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh -d /tmp/Xprintjobs -s .pdf -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%"
|
||||||
|
|
||||||
|
# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
|
||||||
|
# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
|
||||||
|
# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
|
||||||
|
*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
|
||||||
|
# xp-psddx-download-font-type defines which font type is used to download outlines
|
||||||
|
# (valid values are "bitmap", "pstype1" and "pstype3")
|
||||||
|
*xp-psddx-download-font-type: pstype1
|
||||||
|
# EOF.
|
|
@ -0,0 +1,130 @@
|
||||||
|
#!/bin/sh
|
||||||
|
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
verbose_msgs="false"
|
||||||
|
DEFAULT_SPOOLDIR=/tmp/Xprintjobs
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
printf "Usage: ${0}: [options]\n"
|
||||||
|
printf "-v\tbe verbose\n"
|
||||||
|
printf "-d dirname\tdefine spool dir\n"
|
||||||
|
printf "-p string\tname of printer selected by user\n"
|
||||||
|
printf "-c integer\tnumber of copies\n"
|
||||||
|
printf "-t string\tjob title\n"
|
||||||
|
printf "-s string\tfile name suffix\n"
|
||||||
|
printf "-o string\tspooler options\n"
|
||||||
|
printf "-u mask\tpermission mask for new files (see umask)\n"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
verbose()
|
||||||
|
{
|
||||||
|
if ${verbose_msgs} ; then
|
||||||
|
echo "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
spooldir="${DEFAULT_SPOOLDIR}"
|
||||||
|
printername=
|
||||||
|
num_job_copies=
|
||||||
|
job_title=
|
||||||
|
filename_suffix=
|
||||||
|
spooler_options=
|
||||||
|
permmask=
|
||||||
|
while getopts va:b:d:p:c:t:s:o:u: i
|
||||||
|
do
|
||||||
|
case $i in
|
||||||
|
v)
|
||||||
|
verbose_msgs="true"
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
spooldir="$OPTARG"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
printername="$OPTARG"
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
num_job_copies="$OPTARG"
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
job_title="$OPTARG"
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
filename_suffix="$OPTARG"
|
||||||
|
;;
|
||||||
|
o)
|
||||||
|
spooler_options="$OPTARG"
|
||||||
|
;;
|
||||||
|
u)
|
||||||
|
permmask="$OPTARG"
|
||||||
|
;;
|
||||||
|
?) usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
verbose "# spooldir=\"$spooldir\""
|
||||||
|
verbose "# printername=\"$printername\""
|
||||||
|
verbose "# num_job_copies=\"$num_job_copies\""
|
||||||
|
verbose "# job_title=\"$job_title\""
|
||||||
|
verbose "# spooler_options=\"$spooler_options\""
|
||||||
|
verbose "# umask=\"$permmask\""
|
||||||
|
|
||||||
|
if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then
|
||||||
|
mkdir "${DEFAULT_SPOOLDIR}"
|
||||||
|
chmod a+rwxt "${DEFAULT_SPOOLDIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${permmask}" != "" ] ; then
|
||||||
|
umask ${permmask}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$spooldir" ] ; then
|
||||||
|
echo "$0: spooldir \"$spooldir\" does not exits." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -w "$spooldir" ] ; then
|
||||||
|
echo "$0: Cannot write to spooldir \"$spooldir\"." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create first part of the output file name (prefix and an "unique"
|
||||||
|
# id(=date and time))...
|
||||||
|
filename="Xpjob_`date +%Y%m%d%H%M%S`"
|
||||||
|
|
||||||
|
# ... then add options ...
|
||||||
|
if [ "${printername}" != "" ] ; then
|
||||||
|
filename="${filename}_${printername}"
|
||||||
|
fi
|
||||||
|
if [ "${num_job_copies}" != "" -a "${num_job_copies}" != "1" ] ; then
|
||||||
|
filename="${filename}_copies_${num_job_copies}"
|
||||||
|
fi
|
||||||
|
if [ "${job_title}" != "" ] ; then
|
||||||
|
filename="${filename}_title_${job_title}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ... mangle output file name and filter chars (like whitespaces)
|
||||||
|
# which may screw-up further processing by other shell scripts ...
|
||||||
|
filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`"
|
||||||
|
|
||||||
|
# ... add path and suffix ...
|
||||||
|
filename="${spooldir}/${filename}${filename_suffix}"
|
||||||
|
|
||||||
|
verbose "# File name is \"$filename\"."
|
||||||
|
|
||||||
|
# ... and finally capture stdin to the file (we are using "gs" directly to
|
||||||
|
# avoid the problem that "ps2pdf" is not available in all Linux
|
||||||
|
# distributions by default).
|
||||||
|
#ps2pdf - - | cat >"${filename}"
|
||||||
|
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "-sOutputFile=-" -dCompatibilityLevel=1.2 -c .setpdfwrite -f - | cat >"${filename}"
|
||||||
|
|
||||||
|
if ${verbose_msgs} ; then
|
||||||
|
printf "# File is " ; ls -l "${filename}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
verbose "# Done."
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
# EOF.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,136 @@
|
||||||
|
# $Xprint.org: PSdefault model-config,v 1.2 2002/11/07 19:48:04 gisburn Exp $
|
||||||
|
# Generic default model-config for the PostScript DDX
|
||||||
|
#
|
||||||
|
# DO NOT MODIFY THIS FILE!!
|
||||||
|
#
|
||||||
|
# If you want to make customisations for your printer create a copy
|
||||||
|
# of this printer model.
|
||||||
|
# Example (for creating a model config "MYCOMPANYlaserxx"):
|
||||||
|
# 1. Create model config dir:
|
||||||
|
# % mkdir MYCOMPANYlaserxx
|
||||||
|
# 2. Link (or copy) the PMF (printer font metrics) for the
|
||||||
|
# printer buildin fonts:
|
||||||
|
# % ln -s PSdefault/fonts MYCOMPANYlaserxx/.
|
||||||
|
# 3. Copy the model config file:
|
||||||
|
# % cp PSdefault/model-config MYCOMPANYlaserxx/.
|
||||||
|
# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Attributes supported for this printer model
|
||||||
|
# You may want to cut the lists here down to the attributes supported
|
||||||
|
# by your printer.
|
||||||
|
*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
|
||||||
|
*descriptor: PostScript default model
|
||||||
|
*document-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*input-trays-supported:
|
||||||
|
*medium-source-sizes-supported: \
|
||||||
|
{ '' \
|
||||||
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{na-legal FALSE {6.35 209.55 6.35 349.25}}\
|
||||||
|
{executive FALSE {6.35 177.80 6.35 260.35}}\
|
||||||
|
{folio FALSE {6.35 204.47 6.35 323.85}}\
|
||||||
|
{invoice FALSE {6.35 133.35 6.35 209.55}}\
|
||||||
|
{ledger FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{quarto FALSE {6.35 209.55 6.35 268.732}}\
|
||||||
|
{a FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{b FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{c FALSE {6.35 425.45 6.35 552.45}}\
|
||||||
|
{d FALSE {6.35 552.45 6.35 857.25}}\
|
||||||
|
{e FALSE {6.35 857.25 6.35 1111.25}}\
|
||||||
|
{na-6x9-envelope FALSE {6.35 146.05 6.35 222.25}}\
|
||||||
|
{na-10x15-envelope FALSE {6.35 247.65 6.35 374.65}}\
|
||||||
|
{monarch-envelope FALSE {6.35 91.948 6.35 184.15}}\
|
||||||
|
{na-10x13-envelope FALSE {6.35 247.65 6.35 323.85}}\
|
||||||
|
{na-9x12-envelope FALSE {6.35 222.25 6.35 298.45}}\
|
||||||
|
{na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}}\
|
||||||
|
{na-7x9-envelope FALSE {6.35 171.45 6.35 222.25}}\
|
||||||
|
{na-9x11-envelope FALSE {6.35 222.25 6.35 273.05}}\
|
||||||
|
{na-10x14-envelope FALSE {6.35 247.65 6.35 349.25}}\
|
||||||
|
{na-number-9-envelope FALSE {6.35 92.075 6.35 219.075}}\
|
||||||
|
{iso-a0 FALSE {6.35 834.65 6.35 1182.65}}\
|
||||||
|
{iso-a1 FALSE {6.35 587.65 6.35 834.65}}\
|
||||||
|
{iso-a2 FALSE {6.35 413.65 6.35 587.65}}\
|
||||||
|
{iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
|
||||||
|
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
|
||||||
|
{iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
|
||||||
|
{iso-a6 FALSE {6.35 98.65 6.35 141.65}}\
|
||||||
|
{iso-a7 FALSE {6.35 67.65 6.35 98.65}}\
|
||||||
|
{iso-a8 FALSE {6.35 45.65 6.35 67.65}}\
|
||||||
|
{iso-a9 FALSE {6.35 30.65 6.35 45.65}}\
|
||||||
|
{iso-a10 FALSE {6.35 19.65 6.35 30.65}}\
|
||||||
|
{iso-b1 FALSE {6.35 700.65 6.35 993.65}}\
|
||||||
|
{iso-b2 FALSE {6.35 493.65 6.35 700.65}}\
|
||||||
|
{iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
|
||||||
|
{iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
|
||||||
|
{iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
|
||||||
|
{iso-b6 FALSE {6.35 118.65 6.35 169.65}}\
|
||||||
|
{iso-b7 FALSE {6.35 81.65 6.35 118.65}}\
|
||||||
|
{iso-b8 FALSE {6.35 55.65 6.35 81.65}}\
|
||||||
|
{iso-b9 FALSE {6.35 37.65 6.35 55.65}}\
|
||||||
|
{iso-b10 FALSE {6.35 24.65 6.35 37.65}}\
|
||||||
|
{jis-b1 FALSE {6.35 721.65 6.35 1023.65}}\
|
||||||
|
{jis-b2 FALSE {6.35 508.65 6.35 721.65}}\
|
||||||
|
{jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
|
||||||
|
{jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
|
||||||
|
{jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
|
||||||
|
{jis-b6 FALSE {6.35 121.65 6.35 175.65}}\
|
||||||
|
{jis-b7 FALSE {6.35 84.65 6.35 121.65}}\
|
||||||
|
{jis-b8 FALSE {6.35 57.65 6.35 84.65}}\
|
||||||
|
{jis-b9 FALSE {6.35 38.65 6.35 57.65}}\
|
||||||
|
{jis-b10 FALSE {6.35 25.65 6.35 38.65}}\
|
||||||
|
{iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
|
||||||
|
{iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
|
||||||
|
{iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
|
||||||
|
{iso-c6 FALSE {6.35 107.65 6.35 155.65}}\
|
||||||
|
{iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\
|
||||||
|
{hp-2x-postcard FALSE {6.35 141.65 6.35 193.65}}\
|
||||||
|
{hp-european-edp FALSE {6.35 298.45 6.35 349.25}}\
|
||||||
|
{hp-mini FALSE {6.35 133.35 6.35 209.55}}\
|
||||||
|
{hp-postcard FALSE {6.35 93.65 6.35 141.65}}\
|
||||||
|
{hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{hp-us-edp FALSE {6.35 273.05 6.35 349.25}}\
|
||||||
|
{hp-us-government-legal FALSE {6.35 196.85 6.35 323.85}}\
|
||||||
|
{hp-us-government-letter FALSE {6.35 196.85 6.35 247.65}}\
|
||||||
|
}
|
||||||
|
# If you have more than one tray use the following example:
|
||||||
|
# 1. List the supported trays
|
||||||
|
#*input-trays-supported: main manual
|
||||||
|
# 2. Define each tray and it's paper sizes
|
||||||
|
#*medium-source-sizes-supported: \
|
||||||
|
#{ main \
|
||||||
|
# {na-letter FALSE {6.35 209.55 6.35 273.05}} \
|
||||||
|
# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
|
||||||
|
# {iso-a4 FALSE {6.35 203.65 6.35 290.65}} \
|
||||||
|
#} \
|
||||||
|
#{ manual \
|
||||||
|
# {iso-a5 FALSE {6.35 141.65 6.35 203.65}} \
|
||||||
|
# {iso-c5 FALSE {6.35 155.65 6.35 222.65}} \
|
||||||
|
# {iso-designated-long FALSE {6.35 103.65 6.35 213.65}} \
|
||||||
|
# {jis-b5 FALSE {6.35 175.65 6.35 250.65}} \
|
||||||
|
# {monarch-envelope FALSE {6.35 91.948 6.35 184.15}} \
|
||||||
|
# {na-legal FALSE {6.35 209.55 6.35 349.25}} \
|
||||||
|
# {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}} \
|
||||||
|
# {executive FALSE {6.35 177.8 6.35 260.35}} \
|
||||||
|
# {iso-a3 FALSE {6.35 290.65 6.35 413.65}} \
|
||||||
|
# {iso-a0 FALSE {6.35 834.65 6.35 1182.65}} \
|
||||||
|
#}
|
||||||
|
*plexes-supported: simplex duplex tumble
|
||||||
|
*printer-model: "PostScript default model"
|
||||||
|
# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
|
||||||
|
# 940, 1200 and 2440 are supported DPI values, we limit it here
|
||||||
|
# to some common values:
|
||||||
|
*printer-resolutions-supported: 300 360 400 600
|
||||||
|
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-raw-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
|
||||||
|
# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
|
||||||
|
# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
|
||||||
|
# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
|
||||||
|
*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
|
||||||
|
# xp-psddx-download-font-type defines which font type is used to download outlines
|
||||||
|
# (valid values are "bitmap", "pstype1" and "pstype3")
|
||||||
|
*xp-psddx-download-font-type: pstype1
|
||||||
|
# EOF.
|
|
@ -0,0 +1,71 @@
|
||||||
|
# $Xprint.org: PSspooldir model-config,v 1.1 2002/11/25 19:48:04 gisburn Exp $
|
||||||
|
# PostScript DDX model-config which sends jobs to a spool dir instead to a print queue
|
||||||
|
#
|
||||||
|
# This model is basically a cut-down PSdefault model with a custom *xp-spooler-command
|
||||||
|
#
|
||||||
|
# DO NOT MODIFY THIS FILE!!
|
||||||
|
#
|
||||||
|
# If you want to make customisations for your printer create a copy
|
||||||
|
# of this printer model.
|
||||||
|
# Example (for creating a model config "MYCOMPANYlaserxx"):
|
||||||
|
# 1. Create model config dir:
|
||||||
|
# % mkdir MYCOMPANYlaserxx
|
||||||
|
# 2. Link (or copy) the PMF (printer font metrics) for the
|
||||||
|
# printer buildin fonts:
|
||||||
|
# % ln -s PSspooldir/fonts MYCOMPANYlaserxx/.
|
||||||
|
# 3. Copy the model config file:
|
||||||
|
# % cp PSspooldir/model-config MYCOMPANYlaserxx/.
|
||||||
|
# 4. Customize MYCOMPANYlaserxx/model-config to match your needs.
|
||||||
|
#
|
||||||
|
# Attributes supported for this printer model
|
||||||
|
*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape
|
||||||
|
*descriptor: PostScript job spool dir /tmp/Xprintjobs
|
||||||
|
*document-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*input-trays-supported:
|
||||||
|
*medium-source-sizes-supported: \
|
||||||
|
{ '' \
|
||||||
|
{na-letter FALSE {6.35 209.55 6.35 273.05}}\
|
||||||
|
{na-legal FALSE {6.35 209.55 6.35 349.25}}\
|
||||||
|
{executive FALSE {6.35 177.80 6.35 260.35}}\
|
||||||
|
{ledger FALSE {6.35 273.05 6.35 425.45}}\
|
||||||
|
{quarto FALSE {6.35 209.55 6.35 268.732}}\
|
||||||
|
{iso-a3 FALSE {6.35 290.65 6.35 413.65}}\
|
||||||
|
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}\
|
||||||
|
{iso-a5 FALSE {6.35 141.65 6.35 203.65}}\
|
||||||
|
{iso-b3 FALSE {6.35 346.65 6.35 493.65}}\
|
||||||
|
{iso-b4 FALSE {6.35 243.65 6.35 346.65}}\
|
||||||
|
{iso-b5 FALSE {6.35 169.65 6.35 243.65}}\
|
||||||
|
{jis-b3 FALSE {6.35 357.65 6.35 508.65}}\
|
||||||
|
{jis-b4 FALSE {6.35 250.65 6.35 357.65}}\
|
||||||
|
{jis-b5 FALSE {6.35 175.65 6.35 250.65}}\
|
||||||
|
{iso-c3 FALSE {6.35 317.65 6.35 451.65}}\
|
||||||
|
{iso-c4 FALSE {6.35 222.65 6.35 317.65}}\
|
||||||
|
{iso-c5 FALSE {6.35 155.65 6.35 222.65}}\
|
||||||
|
}
|
||||||
|
|
||||||
|
*plexes-supported: simplex duplex tumble
|
||||||
|
*printer-model: "PostScript job spool dir /tmp/Xprintjobs"
|
||||||
|
# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720,
|
||||||
|
# 940, 1200 and 2440 are supported DPI values, we limit it here
|
||||||
|
# to some common values:
|
||||||
|
*printer-resolutions-supported: 300 360 400 600
|
||||||
|
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-raw-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
|
||||||
|
# Use custom spooler script which sends the output to a dir instead to a printer queue
|
||||||
|
# Note that "%xpconfigdir%" is currently only supported in Xprt servers build
|
||||||
|
# from xprint.mozdev.org sources, other platforms have replace it with the
|
||||||
|
# absolute path name to the script
|
||||||
|
*xp-spooler-command: %xpconfigdir%/C/print/models/PSspooldir/spooltodir.sh -d /tmp/Xprintjobs -s .ps -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%"
|
||||||
|
|
||||||
|
# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now.
|
||||||
|
# xp-psddx-download-fonts defines which fonts should be downloaded as outlines
|
||||||
|
# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc")
|
||||||
|
*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc
|
||||||
|
# xp-psddx-download-font-type defines which font type is used to download outlines
|
||||||
|
# (valid values are "bitmap", "pstype1" and "pstype3")
|
||||||
|
*xp-psddx-download-font-type: pstype1
|
||||||
|
# EOF.
|
|
@ -0,0 +1,127 @@
|
||||||
|
#!/bin/sh
|
||||||
|
PATH=/usr/bin:/usr/sbin:/bin:/sbin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
verbose_msgs="false"
|
||||||
|
DEFAULT_SPOOLDIR=/tmp/Xprintjobs
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
printf "Usage: ${0}: [options]\n"
|
||||||
|
printf "-v\tbe verbose\n"
|
||||||
|
printf "-d dirname\tdefine spool dir\n"
|
||||||
|
printf "-p string\tname of printer selected by user\n"
|
||||||
|
printf "-c integer\tnumber of copies\n"
|
||||||
|
printf "-t string\tjob title\n"
|
||||||
|
printf "-s string\tfile name suffix\n"
|
||||||
|
printf "-o string\tspooler options\n"
|
||||||
|
printf "-u mask\tpermission mask for new files (see umask)\n"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
verbose()
|
||||||
|
{
|
||||||
|
if ${verbose_msgs} ; then
|
||||||
|
echo "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
spooldir="${DEFAULT_SPOOLDIR}"
|
||||||
|
printername=
|
||||||
|
num_job_copies=
|
||||||
|
job_title=
|
||||||
|
filename_suffix=
|
||||||
|
spooler_options=
|
||||||
|
permmask=
|
||||||
|
while getopts va:b:d:p:c:t:s:o:u: i
|
||||||
|
do
|
||||||
|
case $i in
|
||||||
|
v)
|
||||||
|
verbose_msgs="true"
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
spooldir="$OPTARG"
|
||||||
|
;;
|
||||||
|
p)
|
||||||
|
printername="$OPTARG"
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
num_job_copies="$OPTARG"
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
job_title="$OPTARG"
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
filename_suffix="$OPTARG"
|
||||||
|
;;
|
||||||
|
o)
|
||||||
|
spooler_options="$OPTARG"
|
||||||
|
;;
|
||||||
|
u)
|
||||||
|
permmask="$OPTARG"
|
||||||
|
;;
|
||||||
|
?) usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
verbose "# spooldir=\"$spooldir\""
|
||||||
|
verbose "# printername=\"$printername\""
|
||||||
|
verbose "# num_job_copies=\"$num_job_copies\""
|
||||||
|
verbose "# job_title=\"$job_title\""
|
||||||
|
verbose "# spooler_options=\"$spooler_options\""
|
||||||
|
verbose "# umask=\"$permmask\""
|
||||||
|
|
||||||
|
if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then
|
||||||
|
mkdir "${DEFAULT_SPOOLDIR}"
|
||||||
|
chmod a+rwxt "${DEFAULT_SPOOLDIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${permmask}" != "" ] ; then
|
||||||
|
umask ${permmask}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$spooldir" ] ; then
|
||||||
|
echo "$0: spooldir \"$spooldir\" does not exits." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -w "$spooldir" ] ; then
|
||||||
|
echo "$0: Cannot write to spooldir \"$spooldir\"." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create first part of the output file name (prefix and an "unique"
|
||||||
|
# id(=date and time))...
|
||||||
|
filename="Xpjob_`date +%Y%m%d%H%M%S`"
|
||||||
|
|
||||||
|
# ... then add options ...
|
||||||
|
if [ "${printername}" != "" ] ; then
|
||||||
|
filename="${filename}_${printername}"
|
||||||
|
fi
|
||||||
|
if [ "${num_job_copies}" != "" -a "${num_job_copies}" != "1" ] ; then
|
||||||
|
filename="${filename}_copies_${num_job_copies}"
|
||||||
|
fi
|
||||||
|
if [ "${job_title}" != "" ] ; then
|
||||||
|
filename="${filename}_title_${job_title}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ... mangle output file name and filter chars (like whitespaces)
|
||||||
|
# which may screw-up further processing by other shell scripts ...
|
||||||
|
filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`"
|
||||||
|
|
||||||
|
# ... add path and suffix ...
|
||||||
|
filename="${spooldir}/${filename}${filename_suffix}"
|
||||||
|
|
||||||
|
verbose "# File name is \"$filename\"."
|
||||||
|
|
||||||
|
# ... and finally capture stdin to the file.
|
||||||
|
cat >"${filename}"
|
||||||
|
|
||||||
|
if ${verbose_msgs} ; then
|
||||||
|
printf "# File is " ; ls -l "${filename}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
verbose "# Done."
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
# EOF.
|
|
@ -1,13 +1,18 @@
|
||||||
# $Xorg: model-config,v 1.3 2000/08/17 19:48:04 cpqbld Exp $
|
# $Xprint.org: SPSPARC2 model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $
|
||||||
SPSPARC2.printer-model: "SunPics SPARCprinter II"
|
*content-orientations-supported: portrait landscape
|
||||||
SPSPARC2.printer-resolutions-supported: 300
|
*descriptor: SunPics SPARCprinter II
|
||||||
SPSPARC2.content-orientations-supported: portrait landscape
|
*document-formats-supported: {POSTSCRIPT 2}
|
||||||
SPSPARC2.document-formats-supported: {PostScript 2}
|
*input-trays-supported:
|
||||||
SPSPARC2.plexes-supported: simplex
|
*medium-source-sizes-supported: \
|
||||||
SPSPARC2.xp-ddx-identifier: XP-POSTSCRIPT
|
|
||||||
SPSPARC2.xp-embedded-formats-supported: { PostScript 2 }
|
|
||||||
*xp-setup-proviso: setup-optional
|
|
||||||
SPSPARC2.medium-source-sizes-supported: \
|
|
||||||
{ '' {na-letter FALSE {6.35 209.55 6.35 273.05}} \
|
{ '' {na-letter FALSE {6.35 209.55 6.35 273.05}} \
|
||||||
{na-legal FALSE {6.35 209.55 6.35 349.25}} \
|
{na-legal FALSE {6.35 209.55 6.35 349.25}} \
|
||||||
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}}
|
{iso-a4 FALSE {6.35 203.65 6.35 290.65}}}
|
||||||
|
*plexes-supported: simplex
|
||||||
|
*printer-model: "SunPics SPARCprinter II"
|
||||||
|
*printer-resolutions-supported: 300
|
||||||
|
*xp-ddx-identifier: XP-POSTSCRIPT
|
||||||
|
*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts
|
||||||
|
*xp-embedded-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-raw-formats-supported: {POSTSCRIPT 2}
|
||||||
|
*xp-setup-proviso: setup-optional
|
||||||
|
# EOF.
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# $Xorg: document,v 1.2 2002/11/30 22:10:03 gisburn Exp $
|
||||||
|
# Document DPA-Object initial attribute values for en_US(-like) locales
|
||||||
|
#
|
||||||
|
# Note that the defaults (for all locales) are set in
|
||||||
|
# ${XPCONFIGDIR}/C/print/attributes/document
|
||||||
|
# Values in ${XPCONFIGDIR}/${LANG}/print/attributes/document are used to
|
||||||
|
# set/override these defaults for a specific locale on demand
|
||||||
|
|
||||||
|
# US and some other countries use US-Letter as default paper size
|
||||||
|
# ("C"-locale default is "ISO-A4")
|
||||||
|
*default-medium: na-letter
|
||||||
|
|
||||||
|
# EOF.
|
|
@ -30,8 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.c,v 1.4 2001/01/17 22:36:27 dawes Exp $ */
|
|
||||||
|
|
||||||
#include <scrnintstr.h>
|
#include <scrnintstr.h>
|
||||||
|
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
@ -46,7 +44,7 @@ static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
|
||||||
&DefaultMediumSize, 1
|
&DefaultMediumSize, 1
|
||||||
};
|
};
|
||||||
static XpOidMediumSourceSize DefaultMediumSourceSize = {
|
static XpOidMediumSourceSize DefaultMediumSourceSize = {
|
||||||
xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
|
xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList
|
||||||
};
|
};
|
||||||
static XpOidMediumSS DefaultMediumSS = {
|
static XpOidMediumSS DefaultMediumSS = {
|
||||||
&DefaultMediumSourceSize, 1
|
&DefaultMediumSourceSize, 1
|
||||||
|
@ -298,7 +296,7 @@ XpPutMediumSSAttr(XpContextPtr pContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
const XpOidMediumSS*
|
const XpOidMediumSS*
|
||||||
XpGetDefaultMediumSS(void)
|
XpGetDefaultMediumSS()
|
||||||
{
|
{
|
||||||
return &DefaultMediumSS;
|
return &DefaultMediumSS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.h,v 1.6 2001/10/31 22:50:27 tsi Exp $ */
|
|
||||||
|
|
||||||
#ifndef _Xp_AttrValid_h
|
#ifndef _Xp_AttrValid_h
|
||||||
#define _Xp_AttrValid_h
|
#define _Xp_AttrValid_h
|
||||||
|
@ -179,7 +178,7 @@ void XpPutMediumSSAttr(XpContextPtr pContext,
|
||||||
XPAttributes pool,
|
XPAttributes pool,
|
||||||
XpOid oid,
|
XpOid oid,
|
||||||
const XpOidMediumSS* msss);
|
const XpOidMediumSS* msss);
|
||||||
const XpOidMediumSS* XpGetDefaultMediumSS(void);
|
const XpOidMediumSS* XpGetDefaultMediumSS();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XpOidTrayMediumList-valued attribute access
|
* XpOidTrayMediumList-valued attribute access
|
||||||
|
@ -193,15 +192,12 @@ void XpPutTrayMediumListAttr(XpContextPtr pContext,
|
||||||
XPAttributes pool,
|
XPAttributes pool,
|
||||||
XpOid oid,
|
XpOid oid,
|
||||||
const XpOidTrayMediumList* tm);
|
const XpOidTrayMediumList* tm);
|
||||||
BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attribute pool validation
|
* Attribute pool validation
|
||||||
*/
|
*/
|
||||||
void XpValidateAttributePool(XpContextPtr pContext,
|
void XpValidateAttributePool(XpContextPtr pContext,
|
||||||
XPAttributes pool,
|
XPAttributes pool,
|
||||||
const XpValidatePoolsRec* vpr);
|
const XpValidatePoolsRec* vpr);
|
||||||
void XpValidateNotificationProfile(XpContextPtr pContext);
|
|
||||||
void XpValidatePrinterPool(XpContextPtr pContext,
|
void XpValidatePrinterPool(XpContextPtr pContext,
|
||||||
const XpValidatePoolsRec* vpr);
|
const XpValidatePoolsRec* vpr);
|
||||||
void XpValidateJobPool(XpContextPtr pContext,
|
void XpValidateJobPool(XpContextPtr pContext,
|
||||||
|
@ -210,9 +206,6 @@ void XpValidateDocumentPool(XpContextPtr pContext,
|
||||||
const XpValidatePoolsRec* vpr);
|
const XpValidatePoolsRec* vpr);
|
||||||
void XpValidatePagePool(XpContextPtr pContext,
|
void XpValidatePagePool(XpContextPtr pContext,
|
||||||
const XpValidatePoolsRec* vpr);
|
const XpValidatePoolsRec* vpr);
|
||||||
void XpValidatePrinterMediaAttrs(XpContextPtr pContext,
|
|
||||||
const XpOidList* valid_trays,
|
|
||||||
const XpOidList* valid_sizes);
|
|
||||||
|
|
||||||
#endif /* _XP_PRINT_SERVER_ */
|
#endif /* _XP_PRINT_SERVER_ */
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/DiPrint.h,v 1.3 1999/12/16 02:26:24 robin Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The XpDiListEntry struct is the type of each element of the array
|
* The XpDiListEntry struct is the type of each element of the array
|
||||||
* handed back to the extension code to handle a GetPrinterList request.
|
* handed back to the extension code to handle a GetPrinterList request.
|
||||||
|
|
270
Xprint/Init.c
270
Xprint/Init.c
|
@ -50,7 +50,6 @@ copyright holders.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/Init.c,v 1.14tsi Exp $ */
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -91,6 +90,7 @@ typedef char *XPointer;
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
#include "spooler.h"
|
||||||
|
|
||||||
static void GenericScreenInit(
|
static void GenericScreenInit(
|
||||||
int index,
|
int index,
|
||||||
|
@ -116,57 +116,6 @@ static Bool InitPrintDrivers(
|
||||||
#define MODELDIRNAME "/models"
|
#define MODELDIRNAME "/models"
|
||||||
#define FONTDIRNAME "/fonts"
|
#define FONTDIRNAME "/fonts"
|
||||||
|
|
||||||
/*
|
|
||||||
* The string LIST_QUEUES is fed to a shell to generate an ordered
|
|
||||||
* list of available printers on the system. These string definitions
|
|
||||||
* are taken from the file PrintSubSys.C within the code for the
|
|
||||||
* dtprintinfo program.
|
|
||||||
*/
|
|
||||||
#ifdef AIXV4
|
|
||||||
const char *LIST_QUEUES = "lsallq | grep -v '^bsh$' | sort";
|
|
||||||
#else
|
|
||||||
#ifdef hpux
|
|
||||||
const char *LIST_QUEUES = "LANG=C lpstat -v | "
|
|
||||||
"awk '"
|
|
||||||
" $2 == \"for\" "
|
|
||||||
" { "
|
|
||||||
" x = match($3, /:/); "
|
|
||||||
" print substr($3, 1, x-1)"
|
|
||||||
" }' | sort";
|
|
||||||
#else
|
|
||||||
#ifdef __osf__
|
|
||||||
const char *LIST_QUEUES = "LANG=C lpstat -v | "
|
|
||||||
"nawk '"
|
|
||||||
" $2 == \"for\" "
|
|
||||||
" { print $4 }' "
|
|
||||||
" | sort";
|
|
||||||
#else
|
|
||||||
#ifdef __uxp__
|
|
||||||
const char *LIST_QUEUES = "LANG=C lpstat -v | "
|
|
||||||
"nawk '"
|
|
||||||
" $4 == \"for\" "
|
|
||||||
" { "
|
|
||||||
" x = match($5, /:/); "
|
|
||||||
" print substr($5, 1, x-1)"
|
|
||||||
" }' | sort";
|
|
||||||
#else
|
|
||||||
#if defined(CSRG_BASED) || defined(linux) || defined(ISC) || defined(__GNUC__)
|
|
||||||
const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | "
|
|
||||||
"sed -e /:/s/// | sort";
|
|
||||||
#else
|
|
||||||
const char *LIST_QUEUES = "LANG=C lpstat -v | "
|
|
||||||
"nawk '"
|
|
||||||
" $2 == \"for\" "
|
|
||||||
" { "
|
|
||||||
" x = match($3, /:/); "
|
|
||||||
" print substr($3, 1, x-1)"
|
|
||||||
" }' | sort";
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XPRASTERDDX
|
#ifdef XPRASTERDDX
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -325,10 +274,64 @@ typedef struct _driverMapping {
|
||||||
int screenNum;
|
int screenNum;
|
||||||
} DriverMapEntry, *DriverMapPtr;
|
} DriverMapEntry, *DriverMapPtr;
|
||||||
|
|
||||||
|
static const char configFilePath[] =
|
||||||
|
"/etc/dt/config/print:/usr/dt/config/print";
|
||||||
|
|
||||||
|
static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
|
||||||
|
|
||||||
|
static int printScreenPrivIndex,
|
||||||
|
printWindowPrivIndex,
|
||||||
|
printGCPrivIndex;
|
||||||
|
static unsigned long printGeneration = 0;
|
||||||
static char *configFileName = (char *)NULL;
|
static char *configFileName = (char *)NULL;
|
||||||
static Bool freeDefaultFontPath = FALSE;
|
static Bool freeDefaultFontPath = FALSE;
|
||||||
static char *origFontPath = (char *)NULL;
|
static char *origFontPath = (char *)NULL;
|
||||||
|
|
||||||
|
static Bool xprintInitGlobalsCalled = FALSE;
|
||||||
|
/*
|
||||||
|
* This function is responsible for doing initalisation of any global
|
||||||
|
* variables at an very early point of server startup (even before
|
||||||
|
* |ProcessCommandLine()|.
|
||||||
|
*/
|
||||||
|
void XprintInitGlobals(void)
|
||||||
|
{
|
||||||
|
xprintInitGlobalsCalled = TRUE;
|
||||||
|
|
||||||
|
#ifdef SMART_SCHEDULE
|
||||||
|
/* Somehow the XF86 "smart scheduler" completely kills the Xprint DDX
|
||||||
|
* (see http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=467
|
||||||
|
* ("Xfree86's "smart scheduler" breaks Xprt") */
|
||||||
|
SmartScheduleDisable = TRUE;
|
||||||
|
#endif /* SMART_SCHEDULE */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XprintUseMsg() prints usage for the Xprint-specific options
|
||||||
|
*/
|
||||||
|
void XprintUseMsg()
|
||||||
|
{
|
||||||
|
XpSpoolerTypePtr curr = xpstm;
|
||||||
|
|
||||||
|
/* Option '-XpFile' */
|
||||||
|
ErrorF("-XpFile file specifies an alternate `Xprinters' file, rather\n");
|
||||||
|
ErrorF(" than the default one (e.g.\n");
|
||||||
|
ErrorF(" `${XPCONFIGDIR}/${LANG}/print/Xprinters') or\n");
|
||||||
|
ErrorF(" `${XPCONFIGDIR}/C/print/Xprinters'.\n");
|
||||||
|
|
||||||
|
/* Option '-XpSpoolerType' */
|
||||||
|
ErrorF("-XpSpoolerType string specifies a spooler type.\n");
|
||||||
|
ErrorF(" Supported values are:\n");
|
||||||
|
|
||||||
|
while( curr->name != NULL )
|
||||||
|
{
|
||||||
|
ErrorF(" - '%s'\n", curr->name);
|
||||||
|
curr++;
|
||||||
|
}
|
||||||
|
ErrorF(" (multiple values can be specified, seperated by ':',\n");
|
||||||
|
ErrorF(" the first active spooler will be chosen).\n");
|
||||||
|
ErrorF(" default is '%s'.\n", XPDEFAULTSPOOLERNAMELIST);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XprintOptions checks argv[i] to see if it is our command line
|
* XprintOptions checks argv[i] to see if it is our command line
|
||||||
* option specifying a configuration file name. It returns the index
|
* option specifying a configuration file name. It returns the index
|
||||||
|
@ -340,6 +343,7 @@ XprintOptions(
|
||||||
char **argv,
|
char **argv,
|
||||||
int i)
|
int i)
|
||||||
{
|
{
|
||||||
|
extern void ddxUseMsg();
|
||||||
if(strcmp(argv[i], "-XpFile") == 0)
|
if(strcmp(argv[i], "-XpFile") == 0)
|
||||||
{
|
{
|
||||||
if ((i + 1) >= argc) {
|
if ((i + 1) >= argc) {
|
||||||
|
@ -349,9 +353,20 @@ XprintOptions(
|
||||||
configFileName = argv[i + 1];
|
configFileName = argv[i + 1];
|
||||||
return i + 2;
|
return i + 2;
|
||||||
}
|
}
|
||||||
|
else if(strcmp(argv[i], "-XpSpoolerType") == 0)
|
||||||
|
{
|
||||||
|
if ((i + 1) >= argc) {
|
||||||
|
ddxUseMsg ();
|
||||||
|
return i + 2;
|
||||||
|
}
|
||||||
|
XpSetSpoolerTypeNameList(argv[i + 1]);
|
||||||
|
return i + 2;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* GetInitFunc --
|
* GetInitFunc --
|
||||||
|
@ -417,7 +432,7 @@ FreePrinterDb(void)
|
||||||
{
|
{
|
||||||
PrinterDbPtr pCurEntry, pNextEntry;
|
PrinterDbPtr pCurEntry, pNextEntry;
|
||||||
|
|
||||||
for(pCurEntry = printerDb, pNextEntry = 0;
|
for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
|
||||||
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
|
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
|
||||||
{
|
{
|
||||||
pNextEntry = pCurEntry->next;
|
pNextEntry = pCurEntry->next;
|
||||||
|
@ -429,7 +444,7 @@ FreePrinterDb(void)
|
||||||
*/
|
*/
|
||||||
xfree(pCurEntry);
|
xfree(pCurEntry);
|
||||||
}
|
}
|
||||||
printerDb = 0;
|
printerDb = (PrinterDbPtr)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -460,11 +475,12 @@ AddPrinterDbName(char *name)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
AugmentPrinterDb(const char *command)
|
AugmentPrinterDb(const char *command)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char name[256];
|
char name[256];
|
||||||
|
int num_printers = 0; /* Number of printers we found */
|
||||||
|
|
||||||
fp = popen(command, "r");
|
fp = popen(command, "r");
|
||||||
/* XXX is a 256 character limit overly restrictive for printer names? */
|
/* XXX is a 256 character limit overly restrictive for printer names? */
|
||||||
|
@ -472,8 +488,10 @@ AugmentPrinterDb(const char *command)
|
||||||
{
|
{
|
||||||
name[strlen(name) - 1] = (char)'\0'; /* strip the \n */
|
name[strlen(name) - 1] = (char)'\0'; /* strip the \n */
|
||||||
AddPrinterDbName(name);
|
AddPrinterDbName(name);
|
||||||
|
num_printers++;
|
||||||
}
|
}
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
|
return num_printers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -592,7 +610,7 @@ StoreDriverNames(void)
|
||||||
"xp-ddx-identifier");
|
"xp-ddx-identifier");
|
||||||
if(pEntry->driverName == (char *)NULL ||
|
if(pEntry->driverName == (char *)NULL ||
|
||||||
strlen(pEntry->driverName) == 0 ||
|
strlen(pEntry->driverName) == 0 ||
|
||||||
GetInitFunc(pEntry->driverName) == 0)
|
GetInitFunc(pEntry->driverName) == (Bool(*)())NULL)
|
||||||
{
|
{
|
||||||
if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
|
if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
|
||||||
ErrorF("Xp Extension: Can't load driver %s\n",
|
ErrorF("Xp Extension: Can't load driver %s\n",
|
||||||
|
@ -650,7 +668,7 @@ GetConfigFileName(void)
|
||||||
/*
|
/*
|
||||||
* Check for a LANG-specific file.
|
* Check for a LANG-specific file.
|
||||||
*/
|
*/
|
||||||
if ((dirName = XpGetConfigDir(TRUE)) != 0)
|
if(dirName = XpGetConfigDir(TRUE))
|
||||||
{
|
{
|
||||||
filePath = (char *)xalloc(strlen(dirName) +
|
filePath = (char *)xalloc(strlen(dirName) +
|
||||||
strlen(XPRINTERSFILENAME) + 2);
|
strlen(XPRINTERSFILENAME) + 2);
|
||||||
|
@ -669,7 +687,7 @@ GetConfigFileName(void)
|
||||||
xfree(filePath);
|
xfree(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dirName = XpGetConfigDir(FALSE)) != 0)
|
if(dirName = XpGetConfigDir(FALSE))
|
||||||
{
|
{
|
||||||
filePath = (char *)xalloc(strlen(dirName) +
|
filePath = (char *)xalloc(strlen(dirName) +
|
||||||
strlen(XPRINTERSFILENAME) + 2);
|
strlen(XPRINTERSFILENAME) + 2);
|
||||||
|
@ -701,6 +719,7 @@ GetConfigFileName(void)
|
||||||
static PrinterDbPtr
|
static PrinterDbPtr
|
||||||
BuildPrinterDb(void)
|
BuildPrinterDb(void)
|
||||||
{
|
{
|
||||||
|
char *printerList, *augmentCmd = (char *)NULL;
|
||||||
Bool defaultAugment = TRUE, freeConfigFileName;
|
Bool defaultAugment = TRUE, freeConfigFileName;
|
||||||
|
|
||||||
if(configFileName && access(configFileName, R_OK) != 0)
|
if(configFileName && access(configFileName, R_OK) != 0)
|
||||||
|
@ -727,7 +746,7 @@ BuildPrinterDb(void)
|
||||||
{
|
{
|
||||||
while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
|
while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
|
||||||
{
|
{
|
||||||
if ((ptr = MbStrchr(tok, '\012')) != 0)
|
if(ptr = MbStrchr(tok, '\012'))
|
||||||
*ptr = (char)'\0';
|
*ptr = (char)'\0';
|
||||||
AddPrinterDbName(tok);
|
AddPrinterDbName(tok);
|
||||||
}
|
}
|
||||||
|
@ -768,7 +787,43 @@ BuildPrinterDb(void)
|
||||||
|
|
||||||
if(defaultAugment == TRUE)
|
if(defaultAugment == TRUE)
|
||||||
{
|
{
|
||||||
AugmentPrinterDb(LIST_QUEUES);
|
XpSpoolerTypePtr curr_spooler_type; /* spooler we are currently probing for queues */
|
||||||
|
int num_printers_found; /* number of printers found by |AugmentPrinterDb()| */
|
||||||
|
char *tok_lasts; /* strtok_r() position token */
|
||||||
|
char *spnamelist; /* list of spooler names, seperated by ":" */
|
||||||
|
char *spname; /* spooler name */
|
||||||
|
|
||||||
|
spnamelist = strdup(XpGetSpoolerTypeNameList()); /* strtok_r() modifies string so dup' it first */
|
||||||
|
|
||||||
|
for( spname = strtok_r(spnamelist, ":", &tok_lasts) ;
|
||||||
|
spname != NULL ;
|
||||||
|
spname = strtok_r(NULL, ":", &tok_lasts) )
|
||||||
|
{
|
||||||
|
curr_spooler_type = XpSpoolerNameToXpSpoolerType(spname);
|
||||||
|
if(!curr_spooler_type)
|
||||||
|
{
|
||||||
|
FatalError("BuildPrinterDb: No spooler type entry found for '%s'.\n", spname);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(curr_spooler_type->list_queues_command == NULL ||
|
||||||
|
strlen(curr_spooler_type->list_queues_command) == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
num_printers_found = AugmentPrinterDb(curr_spooler_type->list_queues_command);
|
||||||
|
/* Did we found a spooler which works ? */
|
||||||
|
if(num_printers_found > 0)
|
||||||
|
{
|
||||||
|
spooler_type = curr_spooler_type;
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "BuildPrinterDb: using '%s'.\n", spooler_type->name);
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(spnamelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
MergeNameMap();
|
MergeNameMap();
|
||||||
|
@ -951,7 +1006,7 @@ FindFontDir(
|
||||||
return (char *)NULL;
|
return (char *)NULL;
|
||||||
|
|
||||||
configDir = XpGetConfigDir(TRUE);
|
configDir = XpGetConfigDir(TRUE);
|
||||||
if ((fontDir = ValidateFontDir(configDir, modelName)) != 0)
|
if(fontDir = ValidateFontDir(configDir, modelName))
|
||||||
{
|
{
|
||||||
xfree(configDir);
|
xfree(configDir);
|
||||||
return fontDir;
|
return fontDir;
|
||||||
|
@ -1013,8 +1068,8 @@ AddToFontPath(
|
||||||
static void
|
static void
|
||||||
AugmentFontPath(void)
|
AugmentFontPath(void)
|
||||||
{
|
{
|
||||||
char *modelID, **allIDs = (char **)NULL;
|
char *newPath, *modelID, **allIDs = (char **)NULL;
|
||||||
PrinterDbPtr pDbEntry;
|
PrinterDbPtr pDb, pDbEntry;
|
||||||
int numModels, i;
|
int numModels, i;
|
||||||
|
|
||||||
if(!origFontPath)
|
if(!origFontPath)
|
||||||
|
@ -1072,7 +1127,7 @@ AugmentFontPath(void)
|
||||||
for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
|
for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
|
||||||
{
|
{
|
||||||
char *fontDir;
|
char *fontDir;
|
||||||
if ((fontDir = FindFontDir(allIDs[i])) != 0)
|
if(fontDir = FindFontDir(allIDs[i]))
|
||||||
{
|
{
|
||||||
AddToFontPath(fontDir);
|
AddToFontPath(fontDir);
|
||||||
xfree(fontDir);
|
xfree(fontDir);
|
||||||
|
@ -1162,7 +1217,7 @@ XpClientIsPrintClient(
|
||||||
* fpe->name.
|
* fpe->name.
|
||||||
*/
|
*/
|
||||||
if(fpe->name_length < PATH_PREFIX_LEN ||
|
if(fpe->name_length < PATH_PREFIX_LEN ||
|
||||||
(strlen(fontDir) != (unsigned)(fpe->name_length - PATH_PREFIX_LEN)) ||
|
(strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) ||
|
||||||
strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
|
strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
|
||||||
fpe->name_length - PATH_PREFIX_LEN))
|
fpe->name_length - PATH_PREFIX_LEN))
|
||||||
{
|
{
|
||||||
|
@ -1235,6 +1290,18 @@ PrinterInitOutput(
|
||||||
char **driverNames;
|
char **driverNames;
|
||||||
char *configDir;
|
char *configDir;
|
||||||
|
|
||||||
|
/* This should NEVER happen, but... */
|
||||||
|
if( !xprintInitGlobalsCalled )
|
||||||
|
{
|
||||||
|
FatalError("Internal error: XprintInitGlobals() not called.");
|
||||||
|
}
|
||||||
|
#ifdef SMART_SCHEDULE
|
||||||
|
if( SmartScheduleDisable != TRUE )
|
||||||
|
{
|
||||||
|
FatalError("Internal error: XF86 smart scheduler incompatible to Xprint DDX.");
|
||||||
|
}
|
||||||
|
#endif /* SMART_SCHEDULE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this little test is just a warning at startup to make sure
|
* this little test is just a warning at startup to make sure
|
||||||
* that the config directory exists.
|
* that the config directory exists.
|
||||||
|
@ -1254,10 +1321,9 @@ PrinterInitOutput(
|
||||||
xfree(configDir);
|
xfree(configDir);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ErrorF("Xp Extension: could not find config dir %s\n",
|
/* Refuse to start when we do not have our config dir... */
|
||||||
|
FatalError("Xp Extension: could not find config dir %s\n",
|
||||||
configDir ? configDir : XPRINTDIR);
|
configDir ? configDir : XPRINTDIR);
|
||||||
|
|
||||||
if (configDir) xfree(configDir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(printerDb != (PrinterDbPtr)NULL)
|
if(printerDb != (PrinterDbPtr)NULL)
|
||||||
|
@ -1414,7 +1480,7 @@ InitPrintDrivers(
|
||||||
}
|
}
|
||||||
if(callInit == TRUE)
|
if(callInit == TRUE)
|
||||||
{
|
{
|
||||||
pBFunc initFunc;
|
Bool (*initFunc)();
|
||||||
initFunc = GetInitFunc(pDb->driverName);
|
initFunc = GetInitFunc(pDb->driverName);
|
||||||
if(initFunc(index, pScreen, argc, argv) == FALSE)
|
if(initFunc(index, pScreen, argc, argv) == FALSE)
|
||||||
{
|
{
|
||||||
|
@ -1451,9 +1517,10 @@ GenericScreenInit(
|
||||||
int argc,
|
int argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
float fWidth, fHeight, maxWidth, maxHeight;
|
float fWidth, fHeight, maxWidth, maxHeight;
|
||||||
unsigned short width, height;
|
unsigned short width, height;
|
||||||
PrinterDbPtr pDb;
|
PrinterDbPtr pDb, pDb2;
|
||||||
int res, maxRes;
|
int res, maxRes;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1477,6 +1544,7 @@ GenericScreenInit(
|
||||||
{
|
{
|
||||||
if(pDb->screenNum == index)
|
if(pDb->screenNum == index)
|
||||||
{
|
{
|
||||||
|
|
||||||
XpValidatePoolsRec *pValRec;
|
XpValidatePoolsRec *pValRec;
|
||||||
pVFunc dimensionsFunc;
|
pVFunc dimensionsFunc;
|
||||||
|
|
||||||
|
@ -1505,6 +1573,57 @@ GenericScreenInit(
|
||||||
(unsigned short)(maxHeight + 0.5);
|
(unsigned short)(maxHeight + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* QualifyName - takes an unqualified file name such as X6printers and
|
||||||
|
* a colon-separated list of directory path names such as
|
||||||
|
* /etc/opt/dt:/opt/dt/config.
|
||||||
|
*
|
||||||
|
* Returns a fully qualified file path name such as /etc/opt/dt/X6printers.
|
||||||
|
* The returned value is malloc'd, and the caller is responsible for
|
||||||
|
* freeing the associated memory.
|
||||||
|
*/
|
||||||
|
static char *
|
||||||
|
QualifyName(fileName, searchPath)
|
||||||
|
char *fileName;
|
||||||
|
char *searchPath;
|
||||||
|
{
|
||||||
|
char * curPath = searchPath;
|
||||||
|
char * nextPath;
|
||||||
|
char * chance;
|
||||||
|
FILE *pFile;
|
||||||
|
|
||||||
|
if (fileName == NULL || searchPath == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if ((nextPath = strchr(curPath, ':')) != NULL)
|
||||||
|
*nextPath = 0;
|
||||||
|
|
||||||
|
chance = (char *)xalloc(strlen(curPath) + strlen(fileName) + 2);
|
||||||
|
sprintf(chance,"%s/%s",curPath,fileName);
|
||||||
|
|
||||||
|
/* see if we can read from the file */
|
||||||
|
if((pFile = fopen(chance, "r")) != (FILE *)NULL)
|
||||||
|
{
|
||||||
|
fclose(pFile);
|
||||||
|
/* ... restore the colon, .... */
|
||||||
|
if (nextPath)
|
||||||
|
*nextPath = ':';
|
||||||
|
|
||||||
|
return chance;
|
||||||
|
}
|
||||||
|
|
||||||
|
xfree(chance);
|
||||||
|
|
||||||
|
if (nextPath == NULL) /* End of path list? */
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* try the next path */
|
||||||
|
curPath = nextPath + 1;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FillPrinterListEntry fills in a single XpDiListEntry element with data
|
* FillPrinterListEntry fills in a single XpDiListEntry element with data
|
||||||
* derived from the supplied PrinterDbPtr element.
|
* derived from the supplied PrinterDbPtr element.
|
||||||
|
@ -1548,12 +1667,11 @@ GetPrinterListInfo(
|
||||||
int localeLen,
|
int localeLen,
|
||||||
char *locale)
|
char *locale)
|
||||||
{
|
{
|
||||||
PrinterDbPtr pDb;
|
PrinterDbPtr pDb, pDb2;
|
||||||
|
|
||||||
for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
|
for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
|
||||||
{
|
{
|
||||||
if (strlen(pDb->name) == (unsigned)nameLen
|
if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen))
|
||||||
&& !strncmp(pDb->name, name, nameLen))
|
|
||||||
{
|
{
|
||||||
FillPrinterListEntry(pEntry, pDb, localeLen, locale);
|
FillPrinterListEntry(pEntry, pDb, localeLen, locale);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1598,7 +1716,7 @@ XpDiGetPrinterList(
|
||||||
if(!nameLen || name == (char *)NULL)
|
if(!nameLen || name == (char *)NULL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PrinterDbPtr pDb;
|
PrinterDbPtr pDb, pDb2;
|
||||||
|
|
||||||
for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
|
for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
|
||||||
pDb = pDb->next, i++)
|
pDb = pDb->next, i++)
|
||||||
|
@ -1648,11 +1766,12 @@ WindowPtr
|
||||||
XpDiValidatePrinter(char *printerName, int printerNameLen)
|
XpDiValidatePrinter(char *printerName, int printerNameLen)
|
||||||
{
|
{
|
||||||
PrinterDbPtr pCurEntry;
|
PrinterDbPtr pCurEntry;
|
||||||
|
WindowPtr pWin;
|
||||||
|
|
||||||
for(pCurEntry = printerDb;
|
for(pCurEntry = printerDb;
|
||||||
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
|
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
|
||||||
{
|
{
|
||||||
if(strlen(pCurEntry->name) == (unsigned)printerNameLen &&
|
if(strlen(pCurEntry->name) == printerNameLen &&
|
||||||
!strncmp(pCurEntry->name, printerName, printerNameLen))
|
!strncmp(pCurEntry->name, printerName, printerNameLen))
|
||||||
return WindowTable[pCurEntry->screenNum];
|
return WindowTable[pCurEntry->screenNum];
|
||||||
}
|
}
|
||||||
|
@ -1680,3 +1799,4 @@ XpDiGetDriverName(int index, char *printerName)
|
||||||
|
|
||||||
return (char *)NULL; /* XXX Should we supply a default driverName? */
|
return (char *)NULL; /* XXX Should we supply a default driverName? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
Xprint/Oid.c
21
Xprint/Oid.c
|
@ -30,7 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/Oid.c,v 1.5tsi Exp $ */
|
|
||||||
|
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
|
||||||
|
@ -274,7 +273,7 @@ XpOidParse(const char* value_string,
|
||||||
*/
|
*/
|
||||||
if(ptr_return != (const char**)NULL)
|
if(ptr_return != (const char**)NULL)
|
||||||
*ptr_return = ptr+length;
|
*ptr_return = ptr+length;
|
||||||
return (XpOid)i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -751,7 +750,7 @@ XpOidLinkedListFirstOid(XpOidLinkedList* me)
|
||||||
XpOid
|
XpOid
|
||||||
XpOidLinkedListNextOid(XpOidLinkedList* me)
|
XpOidLinkedListNextOid(XpOidLinkedList* me)
|
||||||
{
|
{
|
||||||
if(me->current ? (me->current = me->current->next) != 0 : xFalse)
|
if(me->current ? me->current = me->current->next : xFalse)
|
||||||
return me->current->oid;
|
return me->current->oid;
|
||||||
else
|
else
|
||||||
return xpoid_none;
|
return xpoid_none;
|
||||||
|
@ -1652,6 +1651,8 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
|
||||||
const XpOidMediumSS* msss)
|
const XpOidMediumSS* msss)
|
||||||
{
|
{
|
||||||
int i_mss, i_ds, i_itm;
|
int i_mss, i_ds, i_itm;
|
||||||
|
XpOidMediumDiscreteSizeList* ds_list;
|
||||||
|
int tray_count;
|
||||||
XpOid current_tray, current_medium;
|
XpOid current_tray, current_medium;
|
||||||
XpOidMediumDiscreteSizeList* unspecified_tray_ds;
|
XpOidMediumDiscreteSizeList* unspecified_tray_ds;
|
||||||
XpOidMediumDiscreteSizeList* tray_ds;
|
XpOidMediumDiscreteSizeList* tray_ds;
|
||||||
|
@ -1711,7 +1712,6 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
|
||||||
* list
|
* list
|
||||||
*/
|
*/
|
||||||
if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
|
if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
|
||||||
{
|
|
||||||
if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
|
if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1722,10 +1722,7 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
tray_ds = unspecified_tray_ds;
|
tray_ds = unspecified_tray_ds;
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* loop through the discrete sizes list, looking for a size that
|
* loop through the discrete sizes list, looking for a size that
|
||||||
* matches the medium for the current input tray
|
* matches the medium for the current input tray
|
||||||
|
@ -2107,13 +2104,15 @@ const char* XpOidNotifyString(XpOidNotify notify)
|
||||||
{
|
{
|
||||||
switch(notify)
|
switch(notify)
|
||||||
{
|
{
|
||||||
default:
|
|
||||||
case XPOID_NOTIFY_UNSUPPORTED:
|
case XPOID_NOTIFY_UNSUPPORTED:
|
||||||
return (const char*)NULL;
|
return (const char*)NULL;
|
||||||
|
break;
|
||||||
case XPOID_NOTIFY_NONE:
|
case XPOID_NOTIFY_NONE:
|
||||||
return NOTIFY_NONE_STR;
|
return NOTIFY_NONE_STR;
|
||||||
|
break;
|
||||||
case XPOID_NOTIFY_EMAIL:
|
case XPOID_NOTIFY_EMAIL:
|
||||||
return NOTIFY_EMAIL_STR;
|
return NOTIFY_EMAIL_STR;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2238,7 +2237,7 @@ XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
|
||||||
const char* first_nonws_ptr;
|
const char* first_nonws_ptr;
|
||||||
const char* format;
|
const char* format;
|
||||||
const char* variant;
|
const char* variant;
|
||||||
const char* version = 0;
|
const char* version;
|
||||||
int format_len;
|
int format_len;
|
||||||
int variant_len;
|
int variant_len;
|
||||||
int version_len;
|
int version_len;
|
||||||
|
@ -2551,12 +2550,10 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
|
||||||
* variants must both be NULL or match
|
* variants must both be NULL or match
|
||||||
*/
|
*/
|
||||||
if(fmt->variant == (char*)NULL)
|
if(fmt->variant == (char*)NULL)
|
||||||
{
|
|
||||||
if(list->list[i].variant == (char*)NULL)
|
if(list->list[i].variant == (char*)NULL)
|
||||||
return xTrue;
|
return xTrue;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if(list->list[i].variant == (char*)NULL)
|
if(list->list[i].variant == (char*)NULL)
|
||||||
continue;
|
continue;
|
||||||
if(strcmp(fmt->variant, list->list[i].variant) != 0)
|
if(strcmp(fmt->variant, list->list[i].variant) != 0)
|
||||||
|
@ -2565,12 +2562,10 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
|
||||||
* versions must both be NULL or match
|
* versions must both be NULL or match
|
||||||
*/
|
*/
|
||||||
if(fmt->version == (char*)NULL)
|
if(fmt->version == (char*)NULL)
|
||||||
{
|
|
||||||
if(list->list[i].version == (char*)NULL)
|
if(list->list[i].version == (char*)NULL)
|
||||||
return xTrue;
|
return xTrue;
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if(list->list[i].version == (char*)NULL)
|
if(list->list[i].version == (char*)NULL)
|
||||||
continue;
|
continue;
|
||||||
if(strcmp(fmt->version, list->list[i].version) == 0)
|
if(strcmp(fmt->version, list->list[i].version) == 0)
|
||||||
|
|
|
@ -30,7 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/Oid.h,v 1.3 1999/12/16 02:26:24 robin Exp $ */
|
|
||||||
|
|
||||||
#ifndef _Xp_Oid_h
|
#ifndef _Xp_Oid_h
|
||||||
#define _Xp_Oid_h
|
#define _Xp_Oid_h
|
||||||
|
@ -206,7 +205,7 @@ char* XpOidListString(const XpOidList*);
|
||||||
/*
|
/*
|
||||||
* XpOidLinkedList public methods
|
* XpOidLinkedList public methods
|
||||||
*/
|
*/
|
||||||
XpOidLinkedList* XpOidLinkedListNew(void);
|
XpOidLinkedList* XpOidLinkedListNew();
|
||||||
void XpOidLinkedListDelete(XpOidLinkedList*);
|
void XpOidLinkedListDelete(XpOidLinkedList*);
|
||||||
#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
|
#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
|
||||||
XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
|
XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
|
||||||
|
|
|
@ -133,6 +133,14 @@ typedef enum {
|
||||||
xpoid_val_medium_size_jis_b8,
|
xpoid_val_medium_size_jis_b8,
|
||||||
xpoid_val_medium_size_jis_b9,
|
xpoid_val_medium_size_jis_b9,
|
||||||
xpoid_val_medium_size_jis_b10,
|
xpoid_val_medium_size_jis_b10,
|
||||||
|
xpoid_val_medium_size_hp_2x_postcard,
|
||||||
|
xpoid_val_medium_size_hp_european_edp,
|
||||||
|
xpoid_val_medium_size_hp_mini,
|
||||||
|
xpoid_val_medium_size_hp_postcard,
|
||||||
|
xpoid_val_medium_size_hp_tabloid,
|
||||||
|
xpoid_val_medium_size_hp_us_edp,
|
||||||
|
xpoid_val_medium_size_hp_us_government_legal,
|
||||||
|
xpoid_val_medium_size_hp_us_government_letter,
|
||||||
xpoid_val_plex_simplex,
|
xpoid_val_plex_simplex,
|
||||||
xpoid_val_plex_duplex,
|
xpoid_val_plex_duplex,
|
||||||
xpoid_val_plex_tumble,
|
xpoid_val_plex_tumble,
|
||||||
|
|
268
Xprint/OidStrs.h
268
Xprint/OidStrs.h
|
@ -30,140 +30,144 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/OidStrs.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
|
/* This is an automatically-generated file. Do not edit. */
|
||||||
|
|
||||||
static int XpOidStringMapCount = 127;
|
static int XpOidStringMapCount = 127;
|
||||||
|
|
||||||
#define OIDATA(name) { name, sizeof(name)-1, 0, 0, 0 }
|
|
||||||
|
|
||||||
static const XpOidStringMapEntry XpOidStringMap[] = {
|
static const XpOidStringMapEntry XpOidStringMap[] = {
|
||||||
OIDATA(""),
|
{ "", 0 },
|
||||||
OIDATA(""),
|
{ "", 0 },
|
||||||
OIDATA("descriptor"),
|
{ "descriptor", 10 },
|
||||||
OIDATA("content-orientation"),
|
{ "content-orientation", 19 },
|
||||||
OIDATA("copy-count"),
|
{ "copy-count", 10 },
|
||||||
OIDATA("default-printer-resolution"),
|
{ "default-printer-resolution", 26 },
|
||||||
OIDATA("default-input-tray"),
|
{ "default-input-tray", 18 },
|
||||||
OIDATA("default-medium"),
|
{ "default-medium", 14 },
|
||||||
OIDATA("document-format"),
|
{ "document-format", 15 },
|
||||||
OIDATA("plex"),
|
{ "plex", 4 },
|
||||||
OIDATA("xp-listfonts-modes"),
|
{ "xp-listfonts-modes", 18 },
|
||||||
OIDATA("job-name"),
|
{ "job-name", 8 },
|
||||||
OIDATA("job-owner"),
|
{ "job-owner", 9 },
|
||||||
OIDATA("notification-profile"),
|
{ "notification-profile", 20 },
|
||||||
OIDATA("xp-setup-state"),
|
{ "xp-setup-state", 14 },
|
||||||
OIDATA("xp-spooler-command-options"),
|
{ "xp-spooler-command-options", 26 },
|
||||||
OIDATA("content-orientations-supported"),
|
{ "content-orientations-supported", 30 },
|
||||||
OIDATA("document-formats-supported"),
|
{ "document-formats-supported", 26 },
|
||||||
OIDATA("dt-pdm-command"),
|
{ "dt-pdm-command", 14 },
|
||||||
OIDATA("input-trays-medium"),
|
{ "input-trays-medium", 18 },
|
||||||
OIDATA("medium-source-sizes-supported"),
|
{ "medium-source-sizes-supported", 29 },
|
||||||
OIDATA("plexes-supported"),
|
{ "plexes-supported", 16 },
|
||||||
OIDATA("printer-model"),
|
{ "printer-model", 13 },
|
||||||
OIDATA("printer-name"),
|
{ "printer-name", 12 },
|
||||||
OIDATA("printer-resolutions-supported"),
|
{ "printer-resolutions-supported", 29 },
|
||||||
OIDATA("xp-embedded-formats-supported"),
|
{ "xp-embedded-formats-supported", 29 },
|
||||||
OIDATA("xp-listfonts-modes-supported"),
|
{ "xp-listfonts-modes-supported", 28 },
|
||||||
OIDATA("xp-page-attributes-supported"),
|
{ "xp-page-attributes-supported", 28 },
|
||||||
OIDATA("xp-raw-formats-supported"),
|
{ "xp-raw-formats-supported", 24 },
|
||||||
OIDATA("xp-setup-proviso"),
|
{ "xp-setup-proviso", 16 },
|
||||||
OIDATA("document-attributes-supported"),
|
{ "document-attributes-supported", 29 },
|
||||||
OIDATA("job-attributes-supported"),
|
{ "job-attributes-supported", 24 },
|
||||||
OIDATA("locale"),
|
{ "locale", 6 },
|
||||||
OIDATA("multiple-documents-supported"),
|
{ "multiple-documents-supported", 28 },
|
||||||
OIDATA("available-compression"),
|
{ "available-compression", 21 },
|
||||||
OIDATA("available-compressions-supported"),
|
{ "available-compressions-supported", 32 },
|
||||||
OIDATA("portrait"),
|
{ "portrait", 8 },
|
||||||
OIDATA("landscape"),
|
{ "landscape", 9 },
|
||||||
OIDATA("reverse-portrait"),
|
{ "reverse-portrait", 16 },
|
||||||
OIDATA("reverse-landscape"),
|
{ "reverse-landscape", 17 },
|
||||||
OIDATA("iso-a0"),
|
{ "iso-a0", 6 },
|
||||||
OIDATA("iso-a1"),
|
{ "iso-a1", 6 },
|
||||||
OIDATA("iso-a2"),
|
{ "iso-a2", 6 },
|
||||||
OIDATA("iso-a3"),
|
{ "iso-a3", 6 },
|
||||||
OIDATA("iso-a4"),
|
{ "iso-a4", 6 },
|
||||||
OIDATA("iso-a5"),
|
{ "iso-a5", 6 },
|
||||||
OIDATA("iso-a6"),
|
{ "iso-a6", 6 },
|
||||||
OIDATA("iso-a7"),
|
{ "iso-a7", 6 },
|
||||||
OIDATA("iso-a8"),
|
{ "iso-a8", 6 },
|
||||||
OIDATA("iso-a9"),
|
{ "iso-a9", 6 },
|
||||||
OIDATA("iso-a10"),
|
{ "iso-a10", 7 },
|
||||||
OIDATA("iso-b0"),
|
{ "iso-b0", 6 },
|
||||||
OIDATA("iso-b1"),
|
{ "iso-b1", 6 },
|
||||||
OIDATA("iso-b2"),
|
{ "iso-b2", 6 },
|
||||||
OIDATA("iso-b3"),
|
{ "iso-b3", 6 },
|
||||||
OIDATA("iso-b4"),
|
{ "iso-b4", 6 },
|
||||||
OIDATA("iso-b5"),
|
{ "iso-b5", 6 },
|
||||||
OIDATA("iso-b6"),
|
{ "iso-b6", 6 },
|
||||||
OIDATA("iso-b7"),
|
{ "iso-b7", 6 },
|
||||||
OIDATA("iso-b8"),
|
{ "iso-b8", 6 },
|
||||||
OIDATA("iso-b9"),
|
{ "iso-b9", 6 },
|
||||||
OIDATA("iso-b10"),
|
{ "iso-b10", 7 },
|
||||||
OIDATA("na-letter"),
|
{ "na-letter", 9 },
|
||||||
OIDATA("na-legal"),
|
{ "na-legal", 8 },
|
||||||
OIDATA("executive"),
|
{ "executive", 9 },
|
||||||
OIDATA("folio"),
|
{ "folio", 5 },
|
||||||
OIDATA("invoice"),
|
{ "invoice", 7 },
|
||||||
OIDATA("ledger"),
|
{ "ledger", 6 },
|
||||||
OIDATA("quarto"),
|
{ "quarto", 6 },
|
||||||
OIDATA("iso-c3"),
|
{ "iso-c3", 6 },
|
||||||
OIDATA("iso-c4"),
|
{ "iso-c4", 6 },
|
||||||
OIDATA("iso-c5"),
|
{ "iso-c5", 6 },
|
||||||
OIDATA("iso-c6"),
|
{ "iso-c6", 6 },
|
||||||
OIDATA("iso-designated-long"),
|
{ "iso-designated-long", 19 },
|
||||||
OIDATA("na-10x13-envelope"),
|
{ "na-10x13-envelope", 17 },
|
||||||
OIDATA("na-9x12-envelope"),
|
{ "na-9x12-envelope", 16 },
|
||||||
OIDATA("na-number-10-envelope"),
|
{ "na-number-10-envelope", 21 },
|
||||||
OIDATA("na-7x9-envelope"),
|
{ "na-7x9-envelope", 15 },
|
||||||
OIDATA("na-9x11-envelope"),
|
{ "na-9x11-envelope", 16 },
|
||||||
OIDATA("na-10x14-envelope"),
|
{ "na-10x14-envelope", 17 },
|
||||||
OIDATA("na-number-9-envelope"),
|
{ "na-number-9-envelope", 20 },
|
||||||
OIDATA("na-6x9-envelope"),
|
{ "na-6x9-envelope", 15 },
|
||||||
OIDATA("na-10x15-envelope"),
|
{ "na-10x15-envelope", 17 },
|
||||||
OIDATA("monarch-envelope"),
|
{ "monarch-envelope", 16 },
|
||||||
OIDATA("a"),
|
{ "a", 1 },
|
||||||
OIDATA("b"),
|
{ "b", 1 },
|
||||||
OIDATA("c"),
|
{ "c", 1 },
|
||||||
OIDATA("d"),
|
{ "d", 1 },
|
||||||
OIDATA("e"),
|
{ "e", 1 },
|
||||||
OIDATA("jis-b0"),
|
{ "jis-b0", 6 },
|
||||||
OIDATA("jis-b1"),
|
{ "jis-b1", 6 },
|
||||||
OIDATA("jis-b2"),
|
{ "jis-b2", 6 },
|
||||||
OIDATA("jis-b3"),
|
{ "jis-b3", 6 },
|
||||||
OIDATA("jis-b4"),
|
{ "jis-b4", 6 },
|
||||||
OIDATA("jis-b5"),
|
{ "jis-b5", 6 },
|
||||||
OIDATA("jis-b6"),
|
{ "jis-b6", 6 },
|
||||||
OIDATA("jis-b7"),
|
{ "jis-b7", 6 },
|
||||||
OIDATA("jis-b8"),
|
{ "jis-b8", 6 },
|
||||||
OIDATA("jis-b9"),
|
{ "jis-b9", 6 },
|
||||||
OIDATA("jis-b10"),
|
{ "jis-b10", 7 },
|
||||||
OIDATA("simplex"),
|
{ "hp-2x-postcard", 14 },
|
||||||
OIDATA("duplex"),
|
{ "hp-european-edp", 15 },
|
||||||
OIDATA("tumble"),
|
{ "hp-mini", 7 },
|
||||||
OIDATA("top"),
|
{ "hp-postcard", 11 },
|
||||||
OIDATA("middle"),
|
{ "hp-tabloid", 10 },
|
||||||
OIDATA("bottom"),
|
{ "hp-us-edp", 9 },
|
||||||
OIDATA("envelope"),
|
{ "hp-us-government-legal", 22 },
|
||||||
OIDATA("manual"),
|
{ "hp-us-government-letter", 23 },
|
||||||
OIDATA("large-capacity"),
|
{ "simplex", 7 },
|
||||||
OIDATA("main"),
|
{ "duplex", 6 },
|
||||||
OIDATA("side"),
|
{ "tumble", 6 },
|
||||||
OIDATA("event-report-job-completed"),
|
{ "top", 3 },
|
||||||
OIDATA("electronic-mail"),
|
{ "middle", 6 },
|
||||||
OIDATA("xp-setup-mandatory"),
|
{ "bottom", 6 },
|
||||||
OIDATA("xp-setup-optional"),
|
{ "envelope", 8 },
|
||||||
OIDATA("xp-setup-ok"),
|
{ "manual", 6 },
|
||||||
OIDATA("xp-setup-incomplete"),
|
{ "large-capacity", 14 },
|
||||||
OIDATA("xp-list-glyph-fonts"),
|
{ "main", 4 },
|
||||||
OIDATA("xp-list-internal-printer-fonts"),
|
{ "side", 4 },
|
||||||
OIDATA("0"),
|
{ "event-report-job-completed", 26 },
|
||||||
OIDATA("01"),
|
{ "electronic-mail", 15 },
|
||||||
OIDATA("02"),
|
{ "xp-setup-mandatory", 18 },
|
||||||
OIDATA("03"),
|
{ "xp-setup-optional", 17 },
|
||||||
OIDATA("012"),
|
{ "xp-setup-ok", 11 },
|
||||||
OIDATA("013"),
|
{ "xp-setup-incomplete", 19 },
|
||||||
OIDATA("023"),
|
{ "xp-list-glyph-fonts", 19 },
|
||||||
OIDATA("0123")
|
{ "xp-list-internal-printer-fonts", 30 },
|
||||||
|
{ "0", 1 },
|
||||||
|
{ "01", 2 },
|
||||||
|
{ "02", 2 },
|
||||||
|
{ "03", 2 },
|
||||||
|
{ "012", 3 },
|
||||||
|
{ "013", 3 },
|
||||||
|
{ "023", 3 },
|
||||||
|
{ "0123", 4 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef OIDATA
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
/* $XdotOrg: attributes.c,v 1.3 2000/08/17 19:48:07 cpqbld Exp $ */
|
|
||||||
/* $Xorg: attributes.c,v 1.3 2000/08/17 19:48:07 cpqbld Exp $ */
|
/* $Xorg: attributes.c,v 1.3 2000/08/17 19:48:07 cpqbld Exp $ */
|
||||||
/*
|
/*
|
||||||
(c) Copyright 1996 Hewlett-Packard Company
|
(c) Copyright 1996 Hewlett-Packard Company
|
||||||
|
@ -45,18 +44,15 @@ copyright holders.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.20 2003/10/29 22:11:54 tsi Exp $ */
|
|
||||||
|
|
||||||
#include <X11/Xproto.h>
|
#include <Xproto.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#if (defined(sun) && defined(SVR4)) || (defined(SCO))
|
#if (defined(sun) && defined(SVR4)) || (defined(SCO))
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
|
|
||||||
#include <X11/extensions/Printstr.h>
|
#include <X11/extensions/Printstr.h>
|
||||||
|
@ -67,11 +63,13 @@ copyright holders.
|
||||||
#include "Xresource.h"
|
#include "Xresource.h"
|
||||||
#include "Xrm.c"
|
#include "Xrm.c"
|
||||||
|
|
||||||
|
#include "spooler.h"
|
||||||
|
|
||||||
static XrmDatabase CopyDb(XrmDatabase inDb);
|
static XrmDatabase CopyDb(XrmDatabase inDb);
|
||||||
|
|
||||||
extern XrmDatabase XpSpoolerGetServerAttributes(void);
|
extern XrmDatabase XpSpoolerGetServerAttributes(void);
|
||||||
|
|
||||||
static unsigned long attrGeneration = 0;
|
static int attrGeneration = 0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
XrmDatabase *pDb;
|
XrmDatabase *pDb;
|
||||||
|
@ -137,6 +135,26 @@ static const char XPMODELDIR[] = "/models";
|
||||||
|
|
||||||
static char NULL_STRING[] = "\0";
|
static char NULL_STRING[] = "\0";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XpGetConfigDirBase returns a string containing the path name of the base
|
||||||
|
* where the print server configuration directory is localed.
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
char *XpGetConfigDirBase()
|
||||||
|
{
|
||||||
|
char **configDir;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the XPCONFIGDIR environment variable is not set, then use the
|
||||||
|
* compile-time constant XPRINTDIR. XPRINTDIR is passed in on the
|
||||||
|
* compile command line, and is defined in $(TOP)/config/cf/Project.tmpl.
|
||||||
|
*/
|
||||||
|
if((configDir = getenv("XPCONFIGDIR")) == (char *)NULL)
|
||||||
|
configDir = XPRINTDIR;
|
||||||
|
|
||||||
|
return configDir;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XpGetConfigDir returns a string containing the path name of the print
|
* XpGetConfigDir returns a string containing the path name of the print
|
||||||
* server configuration directory. If the useLocale parameter is False
|
* server configuration directory. If the useLocale parameter is False
|
||||||
|
@ -165,13 +183,7 @@ XpGetConfigDir(Bool useLocale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
configDir = XpGetConfigDirBase();
|
||||||
* If the XPCONFIGDIR environment variable is not set, then use the
|
|
||||||
* compile-time constant XPRINTDIR. XPRINTDIR is passed in on the
|
|
||||||
* compile command line, and is defined in $(TOP)/config/cf/Project.tmpl.
|
|
||||||
*/
|
|
||||||
if((configDir = getenv("XPCONFIGDIR")) == (char *)NULL)
|
|
||||||
configDir = XPRINTDIR;
|
|
||||||
|
|
||||||
dirName = (char *)xalloc(strlen(configDir) + strlen(XPDIR) +
|
dirName = (char *)xalloc(strlen(configDir) + strlen(XPDIR) +
|
||||||
strlen(langDir) + 1);
|
strlen(langDir) + 1);
|
||||||
|
@ -307,7 +319,7 @@ BuildPrinterAttrs(
|
||||||
|
|
||||||
if(systemAttributes.printers != (XrmDatabase)NULL)
|
if(systemAttributes.printers != (XrmDatabase)NULL)
|
||||||
{
|
{
|
||||||
char *fileName;
|
char *dirName, *fileName;
|
||||||
XrmDatabase modelDB = (XrmDatabase)NULL;
|
XrmDatabase modelDB = (XrmDatabase)NULL;
|
||||||
XrmName xrm_name[5], xrm_class[2];
|
XrmName xrm_name[5], xrm_class[2];
|
||||||
XrmRepresentation rep_type;
|
XrmRepresentation rep_type;
|
||||||
|
@ -607,6 +619,7 @@ XpGetOneAttribute(
|
||||||
{
|
{
|
||||||
ContextAttrPtr pCtxtAttrs;
|
ContextAttrPtr pCtxtAttrs;
|
||||||
XrmDatabase db = (XrmDatabase)NULL;
|
XrmDatabase db = (XrmDatabase)NULL;
|
||||||
|
char *retVal;
|
||||||
XrmName xrm_name[3];
|
XrmName xrm_name[3];
|
||||||
XrmRepresentation rep_type;
|
XrmRepresentation rep_type;
|
||||||
XrmValue value;
|
XrmValue value;
|
||||||
|
@ -798,7 +811,7 @@ AppendEntry(
|
||||||
char *s, c;
|
char *s, c;
|
||||||
|
|
||||||
if (*type != XrmQString)
|
if (*type != XrmQString)
|
||||||
return False;
|
return;
|
||||||
|
|
||||||
for (firstNameSeen = False; *quarks; bindings++, quarks++) {
|
for (firstNameSeen = False; *quarks; bindings++, quarks++) {
|
||||||
if (*bindings == XrmBindLoosely) {
|
if (*bindings == XrmBindLoosely) {
|
||||||
|
@ -857,6 +870,7 @@ XpGetAttributes(
|
||||||
{
|
{
|
||||||
ContextAttrPtr pCtxtAttrs;
|
ContextAttrPtr pCtxtAttrs;
|
||||||
XrmDatabase db = (XrmDatabase)NULL;
|
XrmDatabase db = (XrmDatabase)NULL;
|
||||||
|
char *retVal;
|
||||||
StringDbStruct enumStruct;
|
StringDbStruct enumStruct;
|
||||||
XrmQuark empty = NULLQUARK;
|
XrmQuark empty = NULLQUARK;
|
||||||
|
|
||||||
|
@ -1064,6 +1078,34 @@ XpSpoolerGetServerAttributes(void)
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ExecuteCommand takes two pointers - the command to execute,
|
||||||
|
* and the "argv" style NULL-terminated vector of arguments for the command.
|
||||||
|
* We wait for the command to terminate before continuing to ensure that
|
||||||
|
* we don't delete the job file before the spooler has made a copy.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
ExecCommand(pCommand, argVector)
|
||||||
|
char *pCommand;
|
||||||
|
char **argVector;
|
||||||
|
{
|
||||||
|
pid_t childPid;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
if((childPid = fork()) == 0)
|
||||||
|
{
|
||||||
|
/* return BadAlloc? */
|
||||||
|
if (execv(pCommand, argVector) == -1) {
|
||||||
|
FatalError("unable to exec '%s'", pCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(void) waitpid(childPid, &status, 0);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SendFileToCommand takes three character pointers - the file name,
|
* SendFileToCommand takes three character pointers - the file name,
|
||||||
* the command to execute,
|
* the command to execute,
|
||||||
|
@ -1120,7 +1162,9 @@ SendFileToCommand(
|
||||||
*/
|
*/
|
||||||
if(userName)
|
if(userName)
|
||||||
{
|
{
|
||||||
if(geteuid() == (uid_t)0)
|
uid_t myUid;
|
||||||
|
|
||||||
|
if((myUid = geteuid()) == (uid_t)0)
|
||||||
{
|
{
|
||||||
struct passwd *pPasswd;
|
struct passwd *pPasswd;
|
||||||
|
|
||||||
|
@ -1137,6 +1181,8 @@ SendFileToCommand(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
(void) close(pipefd[0]);
|
(void) close(pipefd[0]);
|
||||||
|
|
||||||
outPipe = fdopen(pipefd[1], "w");
|
outPipe = fdopen(pipefd[1], "w");
|
||||||
|
@ -1156,6 +1202,7 @@ SendFileToCommand(
|
||||||
* store for the supplied print context. The ReplaceAnyString utility
|
* store for the supplied print context. The ReplaceAnyString utility
|
||||||
* routine is used to perform the actual replacements.
|
* routine is used to perform the actual replacements.
|
||||||
*/
|
*/
|
||||||
|
extern char *ReplaceAnyString(char *, char *, char *);
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
ReplaceAllKeywords(
|
ReplaceAllKeywords(
|
||||||
|
@ -1197,6 +1244,10 @@ ReplaceAllKeywords(
|
||||||
else
|
else
|
||||||
command = ReplaceAnyString(command, "%options%", "");
|
command = ReplaceAnyString(command, "%options%", "");
|
||||||
|
|
||||||
|
/* New in xprint.mozdev.org release 007 - replace "%xpconfigdir%" with
|
||||||
|
* location of $XPCONFIGDIR */
|
||||||
|
command = ReplaceAnyString(command, "%xpconfigdir%", XpGetConfigDirBase());
|
||||||
|
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1367,12 +1418,19 @@ VectorizeCommand(
|
||||||
char ***pVector,
|
char ***pVector,
|
||||||
XpContextPtr pContext)
|
XpContextPtr pContext)
|
||||||
{
|
{
|
||||||
char *cmdName;
|
char *cmdName, *curTok;
|
||||||
|
int i, numChars;
|
||||||
|
|
||||||
if(command == (char *)NULL)
|
if(command == (char *)NULL)
|
||||||
return (char *)NULL;
|
return (char *)NULL;
|
||||||
|
|
||||||
(void) GetToken(command, &cmdName);
|
numChars = GetToken(command, &cmdName);
|
||||||
|
|
||||||
|
if(cmdName == (char *)NULL)
|
||||||
|
return (char *)NULL;
|
||||||
|
|
||||||
|
/* Mangle the command name, too... */
|
||||||
|
cmdName = ReplaceAllKeywords(pContext, cmdName);
|
||||||
|
|
||||||
if(cmdName == (char *)NULL)
|
if(cmdName == (char *)NULL)
|
||||||
return (char *)NULL;
|
return (char *)NULL;
|
||||||
|
@ -1382,27 +1440,35 @@ VectorizeCommand(
|
||||||
return cmdName;
|
return cmdName;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef hpux
|
|
||||||
static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -o raw -n %copy-count% -t %job-name% %options%";
|
|
||||||
#else
|
|
||||||
static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
XpSubmitJob(
|
XpSubmitJob(fileName, pContext)
|
||||||
char *fileName,
|
char *fileName;
|
||||||
XpContextPtr pContext)
|
XpContextPtr pContext;
|
||||||
{
|
{
|
||||||
char **vector, *cmdNam, *command, *userName;
|
char **vector, *cmdNam, *cmdOpt, *command, *userName;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
|
command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
|
||||||
if(command == (char *)NULL || strlen(command) == 0)
|
if(command == (char *)NULL || strlen(command) == 0)
|
||||||
command = strdup(DEFAULT_SPOOL_COMMAND);
|
{
|
||||||
|
if( spooler_type )
|
||||||
|
{
|
||||||
|
command = strdup(spooler_type->spool_command);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
ErrorF("XpSubmitJob: No default spool command defined.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
command = strdup(command);
|
command = strdup(command);
|
||||||
|
}
|
||||||
if(command == (char *)NULL)
|
if(command == (char *)NULL)
|
||||||
|
{
|
||||||
|
ErrorF("XpSubmitJob: No spooler command found, cannot submit job.\n");
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
|
||||||
cmdNam = VectorizeCommand(command, &vector, pContext);
|
cmdNam = VectorizeCommand(command, &vector, pContext);
|
||||||
xfree(command);
|
xfree(command);
|
||||||
|
@ -1431,7 +1497,6 @@ XpSubmitJob(
|
||||||
|
|
||||||
FreeVector(vector);
|
FreeVector(vector);
|
||||||
xfree(cmdNam);
|
xfree(cmdNam);
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1504,6 +1569,7 @@ XpGetTrayMediumFromContext(XpContextPtr pCon,
|
||||||
{
|
{
|
||||||
char *defMedium, *defTray;
|
char *defMedium, *defTray;
|
||||||
char *t, *m;
|
char *t, *m;
|
||||||
|
char *pS, *pE, *pLast;
|
||||||
|
|
||||||
defMedium = XpGetOneAttribute( pCon, XPPageAttr,
|
defMedium = XpGetOneAttribute( pCon, XPPageAttr,
|
||||||
"default-medium" );
|
"default-medium" );
|
||||||
|
|
|
@ -30,7 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/attributes.h,v 1.5 2001/08/01 00:44:45 tsi Exp $ */
|
|
||||||
|
|
||||||
#ifndef _Xp_attributes_h
|
#ifndef _Xp_attributes_h
|
||||||
#define _Xp_attributes_h 1
|
#define _Xp_attributes_h 1
|
||||||
|
|
|
@ -30,13 +30,12 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.13 2001/06/11 16:59:02 dawes Exp $ */
|
|
||||||
|
|
||||||
#include "X.h"
|
#include "X.h"
|
||||||
|
#include "Xos.h"
|
||||||
#include "Xproto.h"
|
#include "Xproto.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include "servermd.h"
|
#include "servermd.h"
|
||||||
#include "Xos.h"
|
|
||||||
#include "DiPrint.h"
|
#include "DiPrint.h"
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
|
@ -71,7 +70,10 @@ InitOutput(
|
||||||
ScreenInfo *pScreenInfo,
|
ScreenInfo *pScreenInfo,
|
||||||
int argc,
|
int argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
|
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
|
||||||
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
|
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
|
||||||
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
|
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
|
||||||
|
@ -171,7 +173,7 @@ InitInput(
|
||||||
int argc,
|
int argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
DeviceIntPtr ptr, kbd;
|
DevicePtr ptr, kbd;
|
||||||
|
|
||||||
ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
|
ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
|
||||||
kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
|
kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
|
||||||
|
@ -215,6 +217,7 @@ OsVendorFatalError(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DDXTIME
|
#ifdef DDXTIME
|
||||||
CARD32
|
CARD32
|
||||||
GetTimeInMillis(void)
|
GetTimeInMillis(void)
|
||||||
|
@ -226,6 +229,12 @@ GetTimeInMillis(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
|
||||||
|
void ddxInitGlobals(void)
|
||||||
|
{
|
||||||
|
XprintInitGlobals();
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
* ddxUseMsg()
|
* ddxUseMsg()
|
||||||
*
|
*
|
||||||
|
@ -235,7 +244,11 @@ GetTimeInMillis(void)
|
||||||
|
|
||||||
void ddxUseMsg(void)
|
void ddxUseMsg(void)
|
||||||
{
|
{
|
||||||
/* Right now, let's just do nothing */
|
/* Enable |XprintUseMsg()| only if |XprintOptions()| is called
|
||||||
|
* by |ddxProcessArgument|, too (see below...) */
|
||||||
|
#ifdef PRINT_ONLY_SERVER
|
||||||
|
XprintUseMsg();
|
||||||
|
#endif /* PRINT_ONLY_SERVER */
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbortDDX (void)
|
void AbortDDX (void)
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#####################################################################
|
||||||
|
### File: 0018.xprint
|
||||||
|
###
|
||||||
|
### Default Location: /usr/dt/config/Xsession.d/
|
||||||
|
###
|
||||||
|
### Purpose: Setup Xprint env vars
|
||||||
|
###
|
||||||
|
### Description: This script is invoked by means of the Xsession file
|
||||||
|
### at user login.
|
||||||
|
###
|
||||||
|
### Invoked by: /usr/dt/bin/Xsession
|
||||||
|
###
|
||||||
|
### (c) Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
###
|
||||||
|
### please send bugfixes or comments to http://xprint.mozdev.org/
|
||||||
|
###
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Obtain list of Xprint servers
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "/etc/init.d/xprint" ] ; then
|
||||||
|
XPSERVERLIST="`/bin/sh /etc/init.d/xprint get_xpserverlist`"
|
||||||
|
export XPSERVERLIST
|
||||||
|
fi
|
||||||
|
|
||||||
|
########################## eof #####################
|
|
@ -0,0 +1,16 @@
|
||||||
|
#
|
||||||
|
# /etc/profile.d/xprint.csh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
# please send bugfixes or comments to http://xprint.mozdev.org/
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Obtain list of Xprint servers
|
||||||
|
#
|
||||||
|
|
||||||
|
if ( -f /etc/init.d/xprint ) then
|
||||||
|
setenv XPSERVERLIST "`/bin/sh /etc/init.d/xprint get_xpserverlist`"
|
||||||
|
endif
|
||||||
|
|
||||||
|
# /etc/profile.d/xprint.csh ends here.
|
|
@ -0,0 +1,16 @@
|
||||||
|
#
|
||||||
|
# /etc/profile.d/xprint.sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
# please send bugfixes or comments to http://xprint.mozdev.org/
|
||||||
|
|
||||||
|
#
|
||||||
|
# Obtain list of Xprint servers
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "/etc/init.d/xprint" ] ; then
|
||||||
|
XPSERVERLIST="`/bin/sh /etc/init.d/xprint get_xpserverlist`"
|
||||||
|
export XPSERVERLIST
|
||||||
|
fi
|
||||||
|
|
||||||
|
# /etc/profile.d/xprint.sh ends here.
|
|
@ -30,8 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/mediaSizes.c,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
**
|
**
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
|
@ -130,6 +128,14 @@ static PageDimensionsRec PageDimensions[] =
|
||||||
{xpoid_val_medium_size_jis_b8, 64, 91},
|
{xpoid_val_medium_size_jis_b8, 64, 91},
|
||||||
{xpoid_val_medium_size_jis_b9, 45, 64},
|
{xpoid_val_medium_size_jis_b9, 45, 64},
|
||||||
{xpoid_val_medium_size_jis_b10, 32, 45},
|
{xpoid_val_medium_size_jis_b10, 32, 45},
|
||||||
|
{xpoid_val_medium_size_hp_2x_postcard, 148, 200},
|
||||||
|
{xpoid_val_medium_size_hp_european_edp, 304.8, 355.6},
|
||||||
|
{xpoid_val_medium_size_hp_mini, 139.7, 215.9},
|
||||||
|
{xpoid_val_medium_size_hp_postcard, 100, 148},
|
||||||
|
{xpoid_val_medium_size_hp_tabloid, 279.4, 431.8},
|
||||||
|
{xpoid_val_medium_size_hp_us_edp, 279.4, 355.6},
|
||||||
|
{xpoid_val_medium_size_hp_us_government_legal, 203.2, 330.2},
|
||||||
|
{xpoid_val_medium_size_hp_us_government_letter, 203.2, 254},
|
||||||
{xpoid_val_medium_size_iso_c3, 324, 458},
|
{xpoid_val_medium_size_iso_c3, 324, 458},
|
||||||
{xpoid_val_medium_size_iso_c4, 229, 324},
|
{xpoid_val_medium_size_iso_c4, 229, 324},
|
||||||
{xpoid_val_medium_size_iso_c5, 162, 229},
|
{xpoid_val_medium_size_iso_c5, 162, 229},
|
||||||
|
@ -145,7 +151,8 @@ static PageDimensionsRec PageDimensions[] =
|
||||||
* attributes pools have been validated.
|
* attributes pools have been validated.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
XpGetResolution(XpContextPtr pContext)
|
XpGetResolution(
|
||||||
|
XpContextPtr pContext)
|
||||||
{
|
{
|
||||||
unsigned long resolution;
|
unsigned long resolution;
|
||||||
|
|
||||||
|
@ -185,7 +192,8 @@ XpGetResolution(XpContextPtr pContext)
|
||||||
* attributes pools have been validated.
|
* attributes pools have been validated.
|
||||||
*/
|
*/
|
||||||
XpOid
|
XpOid
|
||||||
XpGetContentOrientation(XpContextPtr pContext)
|
XpGetContentOrientation(
|
||||||
|
XpContextPtr pContext)
|
||||||
{
|
{
|
||||||
XpOid orientation;
|
XpOid orientation;
|
||||||
|
|
||||||
|
@ -415,7 +423,7 @@ XpGetMediumMillimeters(
|
||||||
float *width, /* return */
|
float *width, /* return */
|
||||||
float *height) /* return */
|
float *height) /* return */
|
||||||
{
|
{
|
||||||
unsigned i;
|
int i;
|
||||||
|
|
||||||
*width = *height = 0;
|
*width = *height = 0;
|
||||||
for(i = 0; i < XpNumber(PageDimensions); i++)
|
for(i = 0; i < XpNumber(PageDimensions); i++)
|
||||||
|
@ -739,7 +747,9 @@ XpGetMaxWidthHeightRes(
|
||||||
}
|
}
|
||||||
|
|
||||||
FontResolutionPtr
|
FontResolutionPtr
|
||||||
XpGetClientResolutions(ClientPtr client, int *num)
|
XpGetClientResolutions(client, num)
|
||||||
|
ClientPtr client;
|
||||||
|
int *num;
|
||||||
{
|
{
|
||||||
static struct _FontResolution res;
|
static struct _FontResolution res;
|
||||||
int resolution = XpGetResolution(XpContextOfClient(client));
|
int resolution = XpGetResolution(XpContextOfClient(client));
|
||||||
|
@ -755,13 +765,15 @@ XpGetClientResolutions(ClientPtr client, int *num)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XpSetFontResFunc(ClientPtr client)
|
void XpSetFontResFunc(client)
|
||||||
|
ClientPtr client;
|
||||||
{
|
{
|
||||||
client->fontResFunc = XpGetClientResolutions;
|
client->fontResFunc = XpGetClientResolutions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XpUnsetFontResFunc(ClientPtr client)
|
void XpUnsetFontResFunc(client)
|
||||||
|
ClientPtr client;
|
||||||
{
|
{
|
||||||
client->fontResFunc = NULL;
|
client->fontResFunc = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
documentation for any purpose is hereby granted without fee, provided that
|
documentation for any purpose is hereby granted without fee, provided that
|
||||||
the above copyright notice appear in all copies and that both that
|
the above copyright notice appear in all copies and that both that
|
||||||
copyright notice and this permission notice appear in supporting
|
copyright notice and this permission notice appear in supporting
|
||||||
|
documentation.
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in
|
||||||
all copies or substantial portions of the Software.
|
all copies or substantial portions of the Software.
|
||||||
|
@ -73,7 +74,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/Ps.h,v 1.13 2001/12/21 21:02:05 dawes Exp $ */
|
|
||||||
|
|
||||||
#ifndef _PS_H_
|
#ifndef _PS_H_
|
||||||
#define _PS_H_
|
#define _PS_H_
|
||||||
|
@ -113,6 +113,7 @@ typedef char *XPointer;
|
||||||
#include <X11/Xresource.h>
|
#include <X11/Xresource.h>
|
||||||
#include "attributes.h"
|
#include "attributes.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public index variables from PsInit.c
|
* Public index variables from PsInit.c
|
||||||
*/
|
*/
|
||||||
|
@ -249,6 +250,63 @@ typedef struct
|
||||||
Bool (*DestroyWindow)(WindowPtr);
|
Bool (*DestroyWindow)(WindowPtr);
|
||||||
} PsScreenPrivRec, *PsScreenPrivPtr;
|
} PsScreenPrivRec, *PsScreenPrivPtr;
|
||||||
|
|
||||||
|
typedef struct PsFontTypeInfoRec PsFontTypeInfoRec;
|
||||||
|
|
||||||
|
/* Structure to hold information about one font on disk
|
||||||
|
* Notes:
|
||||||
|
* - multiple XLFD names can refer to the same |PsFontTypeInfoRec| (if
|
||||||
|
* they all use the same font on the disk)
|
||||||
|
* - the FreeType font download code uses multiple |PsFontTypeInfoRec|
|
||||||
|
* records for one font on disk if they differ in the encoding being
|
||||||
|
* used (this is an exception from the
|
||||||
|
* 'one-|PsFontTypeInfoRec|-per-font-on-disk'-design; maybe it it is better
|
||||||
|
* to rework that in a later step and add a new per-encoding structure).
|
||||||
|
*/
|
||||||
|
struct PsFontTypeInfoRec
|
||||||
|
{
|
||||||
|
PsFontTypeInfoRec *next; /* Next record in list... */
|
||||||
|
char *adobe_ps_name; /* PostScript font name (from the
|
||||||
|
* "_ADOBE_POSTSCRIPT_FONTNAME" atom) */
|
||||||
|
char *download_ps_name; /* PostScript font name used for font download */
|
||||||
|
char *filename; /* File name of font */
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
char *ft_download_encoding; /* encoding used for download */
|
||||||
|
PsFTDownloadFontType ft_download_font_type; /* PS font type used for download (e.g. Type1/Type3/CID/etc.) */
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
int is_iso_encoding; /* Is this font encoded in ISO Latin 1 ? */
|
||||||
|
int font_type; /* See PSFTI_FONT_TYPE_* below... */
|
||||||
|
Bool downloadableFont; /* Font can be downloaded */
|
||||||
|
Bool alreadyDownloaded[256]; /* Font has been downloaded (for 256 8bit "sub"-font) */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PSFTI_FONT_TYPE_OTHER (0)
|
||||||
|
#define PSFTI_FONT_TYPE_PMF (1)
|
||||||
|
#define PSFTI_FONT_TYPE_PS_TYPE1_PFA (2)
|
||||||
|
#define PSFTI_FONT_TYPE_PS_TYPE1_PFB (3)
|
||||||
|
#define PSFTI_FONT_TYPE_TRUETYPE (4)
|
||||||
|
/* PSFTI_FONT_TYPE_FREETYPE is means the font is handled by the freetype engine */
|
||||||
|
#define PSFTI_FONT_TYPE_FREETYPE (5)
|
||||||
|
|
||||||
|
typedef struct PsFontInfoRec PsFontInfoRec;
|
||||||
|
|
||||||
|
/* Structure which represents our context info for a single XLFD font
|
||||||
|
* Note that multiple |PsFontInfoRec| records can share the same
|
||||||
|
* |PsFontTypeInfoRec| record - the |PsFontInfoRec| records represent
|
||||||
|
* different appearances of the same font on disk(=|PsFontTypeInfoRec|)).
|
||||||
|
*/
|
||||||
|
struct PsFontInfoRec
|
||||||
|
{
|
||||||
|
PsFontInfoRec *next; /* Next record in list... */
|
||||||
|
/* |font| and |font_fontPrivate| are used by |PsFindFontInfoRec()| to
|
||||||
|
* identify a font */
|
||||||
|
FontPtr font; /* The font this record is for */
|
||||||
|
pointer font_fontPrivate;
|
||||||
|
PsFontTypeInfoRec *ftir; /* Record about the font file on disk */
|
||||||
|
const char *dfl_name; /* XLFD for this font */
|
||||||
|
int size; /* Font size. Use |mtx| if |size==0| */
|
||||||
|
float mtx[4]; /* Transformation matrix (see |size|) */
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *jobFileName;
|
char *jobFileName;
|
||||||
|
@ -259,6 +317,8 @@ typedef struct
|
||||||
ClientPtr getDocClient;
|
ClientPtr getDocClient;
|
||||||
int getDocBufSize;
|
int getDocBufSize;
|
||||||
PsOutPtr pPsOut;
|
PsOutPtr pPsOut;
|
||||||
|
PsFontTypeInfoRec *fontTypeInfoRecords;
|
||||||
|
PsFontInfoRec *fontInfoRecords;
|
||||||
} PsContextPrivRec, *PsContextPrivPtr;
|
} PsContextPrivRec, *PsContextPrivPtr;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -291,6 +351,7 @@ typedef struct
|
||||||
|
|
||||||
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
|
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
|
||||||
char **argv);
|
char **argv);
|
||||||
|
static Bool PsDestroyContext(XpContextPtr pCon);
|
||||||
extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
|
extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -314,6 +375,10 @@ extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern Bool PsCreateGC(GCPtr pGC);
|
extern Bool PsCreateGC(GCPtr pGC);
|
||||||
|
static int PsGetDrawablePrivateStuff(DrawablePtr pDrawable, GC *gc,
|
||||||
|
unsigned long *valid, PsOutPtr *psOut,
|
||||||
|
ColormapPtr *cMap);
|
||||||
|
extern PsContextPrivPtr PsGetPsContextPriv( DrawablePtr pDrawable );
|
||||||
extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
|
extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
|
||||||
PsOutPtr *psOut, ColormapPtr *cMap);
|
PsOutPtr *psOut, ColormapPtr *cMap);
|
||||||
extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
|
extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
|
||||||
|
@ -366,9 +431,8 @@ extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
|
||||||
extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
|
extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
|
||||||
int x, int y, int w, int h, int leftPad, int format,
|
int x, int y, int w, int h, int leftPad, int format,
|
||||||
char *pImage);
|
char *pImage);
|
||||||
extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth,
|
extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
|
||||||
int x, int y, int w, int h, int leftPad, int format,
|
int w, int h, int leftPad, int format, char *pImage);
|
||||||
char *pImage);
|
|
||||||
extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||||
int srcx, int srcy, int width, int height,
|
int srcx, int srcy, int width, int height,
|
||||||
int dstx, int dsty);
|
int dstx, int dsty);
|
||||||
|
@ -456,7 +520,19 @@ extern Bool PsUnrealizeFont(ScreenPtr pscr, FontPtr pFont);
|
||||||
extern char *PsGetFontName(FontPtr pFont);
|
extern char *PsGetFontName(FontPtr pFont);
|
||||||
extern int PsGetFontSize(FontPtr pFont, float *mtx);
|
extern int PsGetFontSize(FontPtr pFont, float *mtx);
|
||||||
extern char *PsGetPSFontName(FontPtr pFont);
|
extern char *PsGetPSFontName(FontPtr pFont);
|
||||||
|
extern char *PsGetPSFaceOrFontName(FontPtr pFont);
|
||||||
extern int PsIsISOLatin1Encoding(FontPtr pFont);
|
extern int PsIsISOLatin1Encoding(FontPtr pFont);
|
||||||
|
extern char *PsGetEncodingName(FontPtr pFont);
|
||||||
|
extern PsFontInfoRec *PsGetFontInfoRec(DrawablePtr pDrawable, FontPtr pFont);
|
||||||
|
extern void PsFreeFontInfoRecords(PsContextPrivPtr priv);
|
||||||
|
extern PsFTDownloadFontType PsGetFTDownloadFontType(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions in PsFTFonts.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern char *PsGetFTFontFileName(FontPtr pFont);
|
||||||
|
extern Bool PsIsFreeTypeFont(FontPtr pFont);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions in PsAttr.c
|
* Functions in PsAttr.c
|
||||||
|
@ -503,14 +579,4 @@ extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
|
||||||
extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
|
extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
|
||||||
extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
|
extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
|
||||||
|
|
||||||
/*
|
|
||||||
* Functions in PsCache.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef BM_CACHE
|
|
||||||
extern int PsBmIsImageCached(int gWidth, int gHeight, char *pBuffer);
|
|
||||||
extern int PsBmPutImageInCache(int gWidth, int gHeight, char *pBuffer);
|
|
||||||
extern void PsBmClearImageCache(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _PS_H_ */
|
#endif /* _PS_H_ */
|
||||||
|
|
|
@ -228,7 +228,7 @@ error:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
|
PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
|
||||||
int w, int h, int leftPad, int format, int imageRes, char *pImage)
|
int w, int h, int leftPad, int format, int imageRes, char *pImage)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttVal.c,v 1.4 2001/01/17 22:36:31 dawes Exp $ */
|
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
#include "AttrValid.h"
|
#include "AttrValid.h"
|
||||||
|
@ -73,7 +72,16 @@ static XpOidList DefaultPlexes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned long ValidPrinterResolutionsCards[] = {
|
static unsigned long ValidPrinterResolutionsCards[] = {
|
||||||
|
75,
|
||||||
|
100,
|
||||||
|
120,
|
||||||
|
150,
|
||||||
|
180,
|
||||||
|
200,
|
||||||
|
240,
|
||||||
300,
|
300,
|
||||||
|
360,
|
||||||
|
400,
|
||||||
600,
|
600,
|
||||||
720,
|
720,
|
||||||
940,
|
940,
|
||||||
|
@ -86,7 +94,20 @@ static XpOidCardList ValidPrinterResolutions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned long DefaultPrinterResolutionsCards[] = {
|
static unsigned long DefaultPrinterResolutionsCards[] = {
|
||||||
300
|
75,
|
||||||
|
100,
|
||||||
|
120,
|
||||||
|
150,
|
||||||
|
180,
|
||||||
|
200,
|
||||||
|
240,
|
||||||
|
300,
|
||||||
|
360,
|
||||||
|
400,
|
||||||
|
600,
|
||||||
|
720,
|
||||||
|
940,
|
||||||
|
1200
|
||||||
};
|
};
|
||||||
static XpOidCardList DefaultPrinterResolutions = {
|
static XpOidCardList DefaultPrinterResolutions = {
|
||||||
DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
|
DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
|
||||||
|
@ -143,13 +164,6 @@ static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
|
||||||
DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
|
DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
** So filtered printers that accept other raw formats can be
|
|
||||||
** used with this driver.
|
|
||||||
**
|
|
||||||
** Noah Roberts (jik-)
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
|
static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
|
||||||
{ "Postscript", "2", NULL }
|
{ "Postscript", "2", NULL }
|
||||||
|
|
||||||
|
@ -157,7 +171,6 @@ static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
|
||||||
static XpOidDocFmtList ValidRawFormatsSupported = {
|
static XpOidDocFmtList ValidRawFormatsSupported = {
|
||||||
ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
|
ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
|
static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
|
||||||
{ "Postscript", "2", NULL }
|
{ "Postscript", "2", NULL }
|
||||||
|
@ -178,12 +191,74 @@ static XpOidList ValidInputTrays = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static XpOid ValidMediumSizesOids[] = {
|
static XpOid ValidMediumSizesOids[] = {
|
||||||
|
xpoid_val_medium_size_iso_a0,
|
||||||
|
xpoid_val_medium_size_iso_a1,
|
||||||
|
xpoid_val_medium_size_iso_a2,
|
||||||
|
xpoid_val_medium_size_iso_a3,
|
||||||
xpoid_val_medium_size_iso_a4,
|
xpoid_val_medium_size_iso_a4,
|
||||||
|
xpoid_val_medium_size_iso_a5,
|
||||||
|
xpoid_val_medium_size_iso_a6,
|
||||||
|
xpoid_val_medium_size_iso_a7,
|
||||||
|
xpoid_val_medium_size_iso_a8,
|
||||||
|
xpoid_val_medium_size_iso_a9,
|
||||||
|
xpoid_val_medium_size_iso_a10,
|
||||||
|
xpoid_val_medium_size_iso_b0,
|
||||||
|
xpoid_val_medium_size_iso_b1,
|
||||||
|
xpoid_val_medium_size_iso_b2,
|
||||||
|
xpoid_val_medium_size_iso_b3,
|
||||||
|
xpoid_val_medium_size_iso_b4,
|
||||||
|
xpoid_val_medium_size_iso_b5,
|
||||||
|
xpoid_val_medium_size_iso_b6,
|
||||||
|
xpoid_val_medium_size_iso_b7,
|
||||||
|
xpoid_val_medium_size_iso_b8,
|
||||||
|
xpoid_val_medium_size_iso_b9,
|
||||||
|
xpoid_val_medium_size_iso_b10,
|
||||||
xpoid_val_medium_size_na_letter,
|
xpoid_val_medium_size_na_letter,
|
||||||
xpoid_val_medium_size_na_legal,
|
xpoid_val_medium_size_na_legal,
|
||||||
xpoid_val_medium_size_executive,
|
xpoid_val_medium_size_executive,
|
||||||
|
xpoid_val_medium_size_folio,
|
||||||
|
xpoid_val_medium_size_invoice,
|
||||||
|
xpoid_val_medium_size_ledger,
|
||||||
|
xpoid_val_medium_size_quarto,
|
||||||
|
xpoid_val_medium_size_iso_c3,
|
||||||
|
xpoid_val_medium_size_iso_c4,
|
||||||
|
xpoid_val_medium_size_iso_c5,
|
||||||
|
xpoid_val_medium_size_iso_c6,
|
||||||
xpoid_val_medium_size_iso_designated_long,
|
xpoid_val_medium_size_iso_designated_long,
|
||||||
xpoid_val_medium_size_na_number_10_envelope
|
xpoid_val_medium_size_na_10x13_envelope,
|
||||||
|
xpoid_val_medium_size_na_9x12_envelope,
|
||||||
|
xpoid_val_medium_size_na_number_10_envelope,
|
||||||
|
xpoid_val_medium_size_na_7x9_envelope,
|
||||||
|
xpoid_val_medium_size_na_9x11_envelope,
|
||||||
|
xpoid_val_medium_size_na_10x14_envelope,
|
||||||
|
xpoid_val_medium_size_na_number_9_envelope,
|
||||||
|
xpoid_val_medium_size_na_6x9_envelope,
|
||||||
|
xpoid_val_medium_size_na_10x15_envelope,
|
||||||
|
xpoid_val_medium_size_monarch_envelope,
|
||||||
|
xpoid_val_medium_size_a,
|
||||||
|
xpoid_val_medium_size_b,
|
||||||
|
xpoid_val_medium_size_c,
|
||||||
|
xpoid_val_medium_size_d,
|
||||||
|
xpoid_val_medium_size_e,
|
||||||
|
xpoid_val_medium_size_jis_b0,
|
||||||
|
xpoid_val_medium_size_jis_b1,
|
||||||
|
xpoid_val_medium_size_jis_b2,
|
||||||
|
xpoid_val_medium_size_jis_b3,
|
||||||
|
xpoid_val_medium_size_jis_b4,
|
||||||
|
xpoid_val_medium_size_jis_b5,
|
||||||
|
xpoid_val_medium_size_jis_b6,
|
||||||
|
xpoid_val_medium_size_jis_b7,
|
||||||
|
xpoid_val_medium_size_jis_b8,
|
||||||
|
xpoid_val_medium_size_jis_b9,
|
||||||
|
xpoid_val_medium_size_jis_b10,
|
||||||
|
xpoid_val_medium_size_hp_2x_postcard,
|
||||||
|
xpoid_val_medium_size_hp_european_edp,
|
||||||
|
xpoid_val_medium_size_hp_mini,
|
||||||
|
xpoid_val_medium_size_hp_postcard,
|
||||||
|
xpoid_val_medium_size_hp_tabloid,
|
||||||
|
xpoid_val_medium_size_hp_us_edp,
|
||||||
|
xpoid_val_medium_size_hp_us_government_legal,
|
||||||
|
xpoid_val_medium_size_hp_us_government_letter,
|
||||||
};
|
};
|
||||||
static XpOidList ValidMediumSizes = {
|
static XpOidList ValidMediumSizes = {
|
||||||
ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
|
ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
|
||||||
|
@ -205,7 +280,7 @@ XpValidatePoolsRec PsValidatePoolsRec = {
|
||||||
&ValidPrinterResolutions, &DefaultPrinterResolutions,
|
&ValidPrinterResolutions, &DefaultPrinterResolutions,
|
||||||
&ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
|
&ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
|
||||||
&ValidListfontsModes, &DefaultListfontsModes,
|
&ValidListfontsModes, &DefaultListfontsModes,
|
||||||
NULL /* Any raw format specified (NR)*/, &DefaultRawFormatsSupported,
|
&ValidRawFormatsSupported, &DefaultRawFormatsSupported,
|
||||||
&ValidSetupProviso,
|
&ValidSetupProviso,
|
||||||
&DefaultDocumentFormat
|
&DefaultDocumentFormat
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,7 +57,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
* or other dealings in this Software without prior written authorization
|
* or other dealings in this Software without prior written authorization
|
||||||
* from said copyright holders.
|
* from said copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttr.c,v 1.4 2001/01/17 22:36:32 dawes Exp $ */
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
**
|
**
|
||||||
|
@ -76,6 +75,7 @@ in this Software without prior written authorization from The Open Group.
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
|
#include "attributes.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
PsGetAttributes(
|
PsGetAttributes(
|
||||||
|
|
|
@ -73,7 +73,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsColor.c,v 1.2 2001/10/28 03:32:56 tsi Exp $ */
|
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
#include "gcstruct.h"
|
#include "gcstruct.h"
|
||||||
|
@ -86,6 +85,7 @@ PsCreateColormap(ColormapPtr pColor)
|
||||||
int i;
|
int i;
|
||||||
unsigned short rgb;
|
unsigned short rgb;
|
||||||
VisualPtr pVisual = pColor->pVisual;
|
VisualPtr pVisual = pColor->pVisual;
|
||||||
|
Pixel pix;
|
||||||
|
|
||||||
if( pVisual->class==TrueColor )
|
if( pVisual->class==TrueColor )
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "regionstr.h"
|
||||||
|
#include "fontstruct.h"
|
||||||
|
#include "dixfontstr.h"
|
||||||
|
#include "scrnintstr.h"
|
||||||
|
#include "fontxlfd.h"
|
||||||
|
#include "fntfil.h"
|
||||||
|
#include "fntfilst.h"
|
||||||
|
|
||||||
|
#include "Ps.h"
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
|
#include "ft.h"
|
||||||
|
#include "ftfuncs.h"
|
||||||
|
|
||||||
|
char *
|
||||||
|
PsGetFTFontFileName(FontPtr pFont)
|
||||||
|
{
|
||||||
|
FTFontPtr tf = (FTFontPtr)pFont->fontPrivate;
|
||||||
|
return tf->instance->face->filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
PsIsFreeTypeFont(FontPtr pFont)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int nprops = pFont->info.nprops;
|
||||||
|
FontPropPtr props = pFont->info.props;
|
||||||
|
/* "RASTERIZER_NAME" must match the rasterizer name set in
|
||||||
|
* xc/lib/font/FreeType/ftfuncs.c */
|
||||||
|
Atom name = MakeAtom("RASTERIZER_NAME", 15, True);
|
||||||
|
Atom value = (Atom)0;
|
||||||
|
char *rv;
|
||||||
|
|
||||||
|
for( i=0 ; i<nprops ; i++ )
|
||||||
|
{
|
||||||
|
if( props[i].name==name )
|
||||||
|
{ value = props[i].value; break; }
|
||||||
|
}
|
||||||
|
if( !value )
|
||||||
|
return False;
|
||||||
|
|
||||||
|
rv = NameForAtom(value);
|
||||||
|
if( !rv )
|
||||||
|
return False;
|
||||||
|
|
||||||
|
if( memcmp(rv, "FreeType", 8) == 0 )
|
||||||
|
return True;
|
||||||
|
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
* or other dealings in this Software without prior written authorization
|
* or other dealings in this Software without prior written authorization
|
||||||
* from said copyright holders.
|
* from said copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsFonts.c,v 1.6 2001/12/19 21:55:59 dawes Exp $ */
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
**
|
**
|
||||||
|
@ -80,9 +79,15 @@ in this Software without prior written authorization from The Open Group.
|
||||||
#include "dixfontstr.h"
|
#include "dixfontstr.h"
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "fontxlfd.h"
|
#include "fontxlfd.h"
|
||||||
|
#include "fntfil.h"
|
||||||
|
#include "fntfilst.h"
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
PsRealizeFont(
|
PsRealizeFont(
|
||||||
ScreenPtr pscr,
|
ScreenPtr pscr,
|
||||||
|
@ -145,7 +150,9 @@ PsGetPSFontName(FontPtr pFont)
|
||||||
int i;
|
int i;
|
||||||
int nprops = pFont->info.nprops;
|
int nprops = pFont->info.nprops;
|
||||||
FontPropPtr props = pFont->info.props;
|
FontPropPtr props = pFont->info.props;
|
||||||
Atom name = MakeAtom("PRINTER_RESIDENT_FONT", 21, True);
|
/* "_ADOBE_POSTSCRIPT_FONTNAME" maps directly to a PMF OBJ_NAME attribute
|
||||||
|
* name - changing the name will break printer-builtin fonts. */
|
||||||
|
Atom name = MakeAtom("_ADOBE_POSTSCRIPT_FONTNAME", 26, True);
|
||||||
Atom value = (Atom)0;
|
Atom value = (Atom)0;
|
||||||
|
|
||||||
for( i=0 ; i<nprops ; i++ )
|
for( i=0 ; i<nprops ; i++ )
|
||||||
|
@ -184,3 +191,680 @@ PsIsISOLatin1Encoding(FontPtr pFont)
|
||||||
ep[0]!='1' ) return(0);
|
ep[0]!='1' ) return(0);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the encoding part of the XLFD (e.g. "*-iso8859-6.8x" etc.)*/
|
||||||
|
char *PsGetEncodingName(FontPtr pFont)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int nprops = pFont->info.nprops;
|
||||||
|
FontPropPtr props = pFont->info.props;
|
||||||
|
Atom fnt = MakeAtom("FONT", 4, True);
|
||||||
|
Atom reg = MakeAtom("CHARSET_REGISTRY", 16, True);
|
||||||
|
Atom enc = MakeAtom("CHARSET_ENCODING", 16, True);
|
||||||
|
Atom fv = 0, rv = 0, ev = 0;
|
||||||
|
char *fp = 0;
|
||||||
|
char *rp = 0;
|
||||||
|
char *ep = 0;
|
||||||
|
char *encname;
|
||||||
|
|
||||||
|
for( i=0 ; i<nprops ; i++ )
|
||||||
|
{
|
||||||
|
if( props[i].name==fnt ) fv = props[i].value;
|
||||||
|
if( props[i].name==reg ) rv = props[i].value;
|
||||||
|
if( props[i].name==enc ) ev = props[i].value;
|
||||||
|
}
|
||||||
|
if( fv ) fp = NameForAtom(fv);
|
||||||
|
if( rv ) rp = NameForAtom(rv);
|
||||||
|
if( ev ) ep = NameForAtom(ev);
|
||||||
|
|
||||||
|
if( (!rp) || (!ep) || (!fp))
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
encname = fp;
|
||||||
|
encname += strlen(encname) - (strlen(rp) + strlen(ep) + 1);
|
||||||
|
|
||||||
|
return encname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* strstr(), case-insensitive */
|
||||||
|
static
|
||||||
|
char *str_case_str(const char *s, const char *find)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char c,
|
||||||
|
sc;
|
||||||
|
|
||||||
|
if ((c = tolower(*find++)) != '\0')
|
||||||
|
{
|
||||||
|
len = strlen(find);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if ((sc = tolower(*s++)) == '\0')
|
||||||
|
return NULL;
|
||||||
|
} while (sc != c);
|
||||||
|
} while (strncasecmp(s, find, len) != 0);
|
||||||
|
s--;
|
||||||
|
}
|
||||||
|
return ((char *)s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if the font path element is a directory which can be examined
|
||||||
|
* (for example the font may be from a font server
|
||||||
|
* (e.g. pFont->fpe->name == "tcp/:7100"))
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
Bool IsFPEaReadableDir(FontPtr pFont)
|
||||||
|
{
|
||||||
|
const char *fpe_name = pFont->fpe->name;
|
||||||
|
if (!fpe_name)
|
||||||
|
return False;
|
||||||
|
|
||||||
|
#define MODEL_FONTPATH_PREFIX "PRINTER:"
|
||||||
|
#define MODEL_FONTPATH_PREFIX_LEN 8
|
||||||
|
/* Strip model-specific font path prefix if there is one... */
|
||||||
|
if (!strncmp(fpe_name, MODEL_FONTPATH_PREFIX, MODEL_FONTPATH_PREFIX_LEN))
|
||||||
|
fpe_name += MODEL_FONTPATH_PREFIX_LEN;
|
||||||
|
|
||||||
|
if (access(fpe_name, F_OK) == 0)
|
||||||
|
{
|
||||||
|
return True;
|
||||||
|
}
|
||||||
|
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
char *getFontFilename(FontPtr pFont)
|
||||||
|
{
|
||||||
|
FontDirectoryPtr dir;
|
||||||
|
const char *dlfnam;
|
||||||
|
FILE *file;
|
||||||
|
struct stat statb;
|
||||||
|
int count, i, status;
|
||||||
|
char buf[512];
|
||||||
|
char *front, *end, *fn;
|
||||||
|
char font_dir_fname[PATH_MAX], /* Full path of fonts.dir */
|
||||||
|
font_file_fname[PATH_MAX]; /* Name of font file (excluding path) */
|
||||||
|
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
if( PsIsFreeTypeFont(pFont) )
|
||||||
|
{
|
||||||
|
const char *fontname = PsGetFTFontFileName(pFont);
|
||||||
|
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "getFontFilename: freetype font, file='%s'\n", fontname?fontname:"<NULL>");
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
|
||||||
|
if( !fontname )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return strdup(fontname);
|
||||||
|
}
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
|
||||||
|
if (!IsFPEaReadableDir(pFont))
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "getFontFilename: '%s' no valid font path on disk\n", pFont->fpe->name);
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = pFont->fpe->private;
|
||||||
|
sprintf(font_dir_fname, "%s%s", dir->directory, "fonts.dir");
|
||||||
|
|
||||||
|
if (!(dlfnam = PsGetFontName(pFont)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
file = fopen(font_dir_fname, "r");
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
if (fstat (fileno(file), &statb) == -1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
while( fgets(buf, sizeof(buf)-1, file) )
|
||||||
|
{
|
||||||
|
if ((fn = strstr(buf, " -")))
|
||||||
|
{
|
||||||
|
strcpy(font_file_fname, buf);
|
||||||
|
font_file_fname[fn - buf] = '\0';
|
||||||
|
fn++;
|
||||||
|
if ((front = str_case_str(fn, "normal-")))
|
||||||
|
{
|
||||||
|
fn[front - fn] = '\0';
|
||||||
|
if (str_case_str(dlfnam, fn))
|
||||||
|
{
|
||||||
|
char full_font_file_path[PATH_MAX];
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
sprintf(full_font_file_path, "%s%s", dir->directory, font_file_fname);
|
||||||
|
|
||||||
|
#ifdef xDEBUG_gisburn
|
||||||
|
fprintf(stderr, "getFontFilename: returning '%s'\n", full_font_file_path);
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
return strdup(full_font_file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
font_file_fname[0] = '\0';
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "getFontFilename: returning NULL\n");
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PsFontTypeInfoRec *PsFindFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont)
|
||||||
|
{
|
||||||
|
PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
|
||||||
|
PsFontTypeInfoRec *rec;
|
||||||
|
const char *psname;
|
||||||
|
char *font_filename;
|
||||||
|
char *encname;
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
Bool is_freetypefont;
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
is_freetypefont = PsIsFreeTypeFont(pFont);
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
encname = PsGetEncodingName(pFont);
|
||||||
|
|
||||||
|
/* First try: Search by PostScript font name */
|
||||||
|
psname = PsGetPSFontName(pFont);
|
||||||
|
if (psname)
|
||||||
|
{
|
||||||
|
for( rec = cPriv->fontTypeInfoRecords ; rec != NULL ; rec = rec->next )
|
||||||
|
{
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
if (is_freetypefont)
|
||||||
|
{
|
||||||
|
if (rec->adobe_ps_name)
|
||||||
|
{
|
||||||
|
if ((rec->font_type == PSFTI_FONT_TYPE_FREETYPE) &&
|
||||||
|
(!strcmp(rec->adobe_ps_name, psname)) &&
|
||||||
|
(!strcmp(rec->ft_download_encoding, encname)))
|
||||||
|
{
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
{
|
||||||
|
if (rec->adobe_ps_name)
|
||||||
|
{
|
||||||
|
if ((rec->font_type != PSFTI_FONT_TYPE_FREETYPE) &&
|
||||||
|
(!strcmp(rec->adobe_ps_name, psname)))
|
||||||
|
{
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Last attempt: Search by filename */
|
||||||
|
font_filename = getFontFilename(pFont);
|
||||||
|
if (font_filename)
|
||||||
|
{
|
||||||
|
for( rec = cPriv->fontTypeInfoRecords ; rec != NULL ; rec = rec->next )
|
||||||
|
{
|
||||||
|
if (rec->filename)
|
||||||
|
{
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
if (is_freetypefont)
|
||||||
|
{
|
||||||
|
if ( (rec->font_type == PSFTI_FONT_TYPE_FREETYPE) &&
|
||||||
|
(!strcasecmp(rec->filename, font_filename)) &&
|
||||||
|
(!strcasecmp(rec->ft_download_encoding, encname)) )
|
||||||
|
{
|
||||||
|
free(font_filename);
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
{
|
||||||
|
if ( (rec->font_type != PSFTI_FONT_TYPE_FREETYPE) &&
|
||||||
|
(!strcasecmp(rec->filename, font_filename)) )
|
||||||
|
{
|
||||||
|
free(font_filename);
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(font_filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void PsAddFontTypeInfoRec(DrawablePtr pDrawable, PsFontTypeInfoRec *add_rec)
|
||||||
|
{
|
||||||
|
PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
|
||||||
|
|
||||||
|
/* ToDO: Always move the last used entry to the top that the list get's
|
||||||
|
* sorted in an efficient order... :-) */
|
||||||
|
add_rec->next = cPriv->fontTypeInfoRecords;
|
||||||
|
cPriv->fontTypeInfoRecords = add_rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
Bool strcaseendswith(const char *str, const char *suffix)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
s = str + strlen(str) - strlen(suffix);
|
||||||
|
|
||||||
|
if (!strcasecmp(s, suffix))
|
||||||
|
return True;
|
||||||
|
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
int getFontFileType( const char *filename )
|
||||||
|
{
|
||||||
|
int type;
|
||||||
|
|
||||||
|
/* Is this a Adobe PostScript Type 1 binary font (PFB) ? */
|
||||||
|
if( strcaseendswith(filename, ".pfb") )
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_PS_TYPE1_PFB;
|
||||||
|
}
|
||||||
|
/* Is this a Adobe PostScript ASCII font (PFA) ? */
|
||||||
|
else if( strcaseendswith(filename, ".pfa") )
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_PS_TYPE1_PFA;
|
||||||
|
}
|
||||||
|
/* Is this a PMF(=Printer Metrics File) ? */
|
||||||
|
else if( strcaseendswith(filename, ".pmf") )
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_PMF;
|
||||||
|
}
|
||||||
|
/* Is this a TrueType font file ? */
|
||||||
|
else if( strcaseendswith(filename, ".ttf") ||
|
||||||
|
strcaseendswith(filename, ".ttc") ||
|
||||||
|
strcaseendswith(filename, ".otf") ||
|
||||||
|
strcaseendswith(filename, ".otc") )
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_TRUETYPE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
{
|
||||||
|
XpContextPtr pCon;
|
||||||
|
char *downloadfonts;
|
||||||
|
pCon = XpGetPrintContext(requestingClient);
|
||||||
|
downloadfonts = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-psddx-download-fonts");
|
||||||
|
if( downloadfonts )
|
||||||
|
{
|
||||||
|
/* Should we download PS Type1 fonts as PS Type1||Type3 ? */
|
||||||
|
if( (type == PSFTI_FONT_TYPE_PS_TYPE1_PFA) &&
|
||||||
|
(strstr(downloadfonts, "pfa") != NULL) )
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_FREETYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (type == PSFTI_FONT_TYPE_PS_TYPE1_PFB) &&
|
||||||
|
(strstr(downloadfonts, "pfb") != NULL) )
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_FREETYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Should we download TrueType fonts as PS Type1||Type3 ? */
|
||||||
|
if( (type == PSFTI_FONT_TYPE_TRUETYPE) &&
|
||||||
|
((strstr(downloadfonts, "ttf") != NULL) ||
|
||||||
|
(strstr(downloadfonts, "ttc") != NULL) ||
|
||||||
|
(strstr(downloadfonts, "otf") != NULL) ||
|
||||||
|
(strstr(downloadfonts, "otc") != NULL)) )
|
||||||
|
{
|
||||||
|
type = PSFTI_FONT_TYPE_FREETYPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "getFontFileType: '%s' is %d\n", filename, (int)type);
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
PsFTDownloadFontType PsGetFTDownloadFontType(void)
|
||||||
|
{
|
||||||
|
PsFTDownloadFontType downloadfonttype;
|
||||||
|
XpContextPtr pCon;
|
||||||
|
char *psfonttype;
|
||||||
|
|
||||||
|
pCon = XpGetPrintContext(requestingClient);
|
||||||
|
psfonttype = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-psddx-download-font-type");
|
||||||
|
|
||||||
|
if( !psfonttype || !strlen(psfonttype) )
|
||||||
|
{
|
||||||
|
return PsFontType1; /* Default download font type is PS Type1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !strcmp(psfonttype, "bitmap") )
|
||||||
|
{
|
||||||
|
downloadfonttype = PsFontBitmap;
|
||||||
|
}
|
||||||
|
else if( !strcmp(psfonttype, "pstype3") )
|
||||||
|
{
|
||||||
|
downloadfonttype = PsFontType3;
|
||||||
|
}
|
||||||
|
else if( !strcmp(psfonttype, "pstype1") )
|
||||||
|
{
|
||||||
|
downloadfonttype = PsFontType1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalError("PS DDX: XPPrinterAttr/xp-psddx-download-freetype-font-type='%s' not implemented\n", psfonttype);
|
||||||
|
return 0; /* NO-OP, FatalError() will call |exit()| */
|
||||||
|
}
|
||||||
|
|
||||||
|
return downloadfonttype;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PsFontTypeInfoRec *PsCreateFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont)
|
||||||
|
{
|
||||||
|
char *dlfnam;
|
||||||
|
PsFontTypeInfoRec *rec;
|
||||||
|
char *psname;
|
||||||
|
|
||||||
|
if (!(dlfnam = PsGetFontName(pFont)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!(rec = (PsFontTypeInfoRec *)xalloc(sizeof(PsFontTypeInfoRec))))
|
||||||
|
return NULL;
|
||||||
|
memset(rec, 0, sizeof(PsFontTypeInfoRec));
|
||||||
|
|
||||||
|
rec->next = NULL;
|
||||||
|
|
||||||
|
if (rec->filename = getFontFilename(pFont))
|
||||||
|
{
|
||||||
|
rec->font_type = getFontFileType(rec->filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rec->filename = NULL;
|
||||||
|
rec->font_type = PSFTI_FONT_TYPE_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
rec->adobe_ps_name = PsGetPSFontName(pFont);
|
||||||
|
rec->ft_download_encoding = PsGetEncodingName(pFont);
|
||||||
|
rec->ft_download_font_type = PsGetFTDownloadFontType();
|
||||||
|
rec->download_ps_name = NULL;
|
||||||
|
|
||||||
|
#define SET_FONT_DOWNLOAD_STATUS(rec, downloaded) { int i; for (i = 0 ; i < 256 ; i++) { (rec)->alreadyDownloaded[i]=(downloaded); } }
|
||||||
|
|
||||||
|
/* Set some flags based on the font type */
|
||||||
|
switch( rec->font_type )
|
||||||
|
{
|
||||||
|
case PSFTI_FONT_TYPE_PS_TYPE1_PFA:
|
||||||
|
case PSFTI_FONT_TYPE_PS_TYPE1_PFB:
|
||||||
|
rec->downloadableFont = True;
|
||||||
|
SET_FONT_DOWNLOAD_STATUS(rec, False);
|
||||||
|
rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PSFTI_FONT_TYPE_PMF:
|
||||||
|
rec->downloadableFont = True; /* This font is in printer's ROM */
|
||||||
|
SET_FONT_DOWNLOAD_STATUS(rec, True);
|
||||||
|
rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PSFTI_FONT_TYPE_TRUETYPE:
|
||||||
|
/* Note: TrueType font download not implemented */
|
||||||
|
rec->downloadableFont = False;
|
||||||
|
SET_FONT_DOWNLOAD_STATUS(rec, False);
|
||||||
|
rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
case PSFTI_FONT_TYPE_FREETYPE:
|
||||||
|
if( rec->ft_download_font_type == PsFontType1 ||
|
||||||
|
rec->ft_download_font_type == PsFontType3 )
|
||||||
|
{
|
||||||
|
rec->downloadableFont = True;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rec->downloadableFont = False;
|
||||||
|
}
|
||||||
|
|
||||||
|
SET_FONT_DOWNLOAD_STATUS(rec, False);
|
||||||
|
rec->is_iso_encoding = False; /* Freetype--->PS Type1/Type3 uses always non-iso PS encoding for now */
|
||||||
|
break;
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
|
||||||
|
case PSFTI_FONT_TYPE_OTHER:
|
||||||
|
default:
|
||||||
|
rec->downloadableFont = False;
|
||||||
|
SET_FONT_DOWNLOAD_STATUS(rec, False);
|
||||||
|
rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
if( (rec->font_type == PSFTI_FONT_TYPE_FREETYPE) )
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
register int c;
|
||||||
|
|
||||||
|
if( rec->adobe_ps_name )
|
||||||
|
{
|
||||||
|
rec->download_ps_name = malloc(strlen(rec->adobe_ps_name) + strlen(rec->ft_download_encoding) + 2);
|
||||||
|
sprintf(rec->download_ps_name, "%s_%s", rec->adobe_ps_name, rec->ft_download_encoding);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Unfortunately not all TTF fonts have a PostScript font name (like
|
||||||
|
* Solaris TTF fonts in /usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType,
|
||||||
|
* /usr/openwin/lib/locale/ko/X11/fonts/TrueType) - in this case we
|
||||||
|
* have to generate a font name
|
||||||
|
*/
|
||||||
|
char ftfontname[64];
|
||||||
|
static long myfontindex = 0L;
|
||||||
|
sprintf(ftfontname, "psfont_%lx", myfontindex++);
|
||||||
|
|
||||||
|
rec->download_ps_name = malloc(strlen(ftfontname) + strlen(rec->ft_download_encoding) + 2);
|
||||||
|
sprintf(rec->download_ps_name, "%s_%s", ftfontname, rec->ft_download_encoding);
|
||||||
|
|
||||||
|
fprintf(stderr, "PsCreateFontTypeInfoRec: Note: '%s' has no PS font name, using '%s' for now.\n", dlfnam, rec->download_ps_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure the font name we use for download is a valid PS font name */
|
||||||
|
for( s = rec->download_ps_name ; *s != '\0'; s++ )
|
||||||
|
{
|
||||||
|
c = *s;
|
||||||
|
|
||||||
|
/* Check for allowed chars, invalid ones are replaced with a '_'
|
||||||
|
* (and check that the first char is not a digit) */
|
||||||
|
if( !(isalnum(c) || c == '.' || c == '_' || c == '-') || (s==rec->download_ps_name && isdigit(c)) )
|
||||||
|
{
|
||||||
|
*s = '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
{
|
||||||
|
if( rec->adobe_ps_name )
|
||||||
|
{
|
||||||
|
rec->download_ps_name = strdup(rec->adobe_ps_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rec->download_ps_name = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Safeguard - only treat font as downloadable when we have a PS font name!! */
|
||||||
|
if (!rec->download_ps_name && rec->downloadableFont)
|
||||||
|
{
|
||||||
|
/* XXX: Log this message to the log when the logging service has been hook'ed up */
|
||||||
|
fprintf(stderr, "PsCreateFontTypeInfoRec: Safeguard: No PS font name for '%s'!\n", dlfnam);
|
||||||
|
rec->downloadableFont = False;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "PsCreateFontTypeInfoRec: Created PsFontTypeInfoRec '%s' ('%s'/'%s')\n",
|
||||||
|
((rec->filename) ?(rec->filename) :("<null>")),
|
||||||
|
((rec->adobe_ps_name) ?(rec->adobe_ps_name):("<null>")),
|
||||||
|
((rec->download_ps_name)?(rec->download_ps_name):("<null>")));
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PsFontTypeInfoRec *PsGetFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont)
|
||||||
|
{
|
||||||
|
PsFontTypeInfoRec *rec;
|
||||||
|
char *dlfnam;
|
||||||
|
|
||||||
|
if(!(dlfnam = PsGetFontName(pFont)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
rec = PsFindFontTypeInfoRec(pDrawable, pFont);
|
||||||
|
if (rec)
|
||||||
|
return rec;
|
||||||
|
|
||||||
|
rec = PsCreateFontTypeInfoRec(pDrawable, pFont);
|
||||||
|
if (!rec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
PsAddFontTypeInfoRec(pDrawable, rec);
|
||||||
|
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void PsFreeFontTypeInfoRecords( PsContextPrivPtr priv )
|
||||||
|
{
|
||||||
|
PsFontTypeInfoRec *curr, *next;
|
||||||
|
curr = priv->fontTypeInfoRecords;
|
||||||
|
while( curr != NULL )
|
||||||
|
{
|
||||||
|
if (curr->filename)
|
||||||
|
free(curr->filename); /* Free memory allocated by |strdup()| */
|
||||||
|
|
||||||
|
if (curr->download_ps_name)
|
||||||
|
free(curr->download_ps_name);
|
||||||
|
|
||||||
|
next = curr->next;
|
||||||
|
xfree(curr);
|
||||||
|
curr = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PsFontInfoRec *PsFindFontInfoRec(DrawablePtr pDrawable, FontPtr pFont)
|
||||||
|
{
|
||||||
|
PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
|
||||||
|
PsFontInfoRec *rec;
|
||||||
|
|
||||||
|
if (!pFont)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for( rec = cPriv->fontInfoRecords ; rec != NULL ; rec = rec->next )
|
||||||
|
{
|
||||||
|
if ((rec->font == pFont) &&
|
||||||
|
(rec->font_fontPrivate == pFont->fontPrivate))
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
void PsAddFontInfoRec(DrawablePtr pDrawable, PsFontInfoRec *add_rec)
|
||||||
|
{
|
||||||
|
PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable);
|
||||||
|
|
||||||
|
/* ToDO: Always move the last used entry to the top that the list get's
|
||||||
|
* sorted in an efficient order... :-) */
|
||||||
|
add_rec->next = cPriv->fontInfoRecords;
|
||||||
|
cPriv->fontInfoRecords = add_rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
PsFontInfoRec *PsCreateFontInfoRec(DrawablePtr pDrawable, FontPtr pFont)
|
||||||
|
{
|
||||||
|
PsFontInfoRec *rec;
|
||||||
|
PsFontTypeInfoRec *ftir;
|
||||||
|
|
||||||
|
if (!(ftir = PsGetFontTypeInfoRec(pDrawable, pFont)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!(rec = (PsFontInfoRec *)xalloc(sizeof(PsFontInfoRec))))
|
||||||
|
return NULL;
|
||||||
|
memset(rec, 0, sizeof(PsFontInfoRec));
|
||||||
|
|
||||||
|
rec->font = pFont;
|
||||||
|
rec->font_fontPrivate = pFont->fontPrivate;
|
||||||
|
rec->ftir = ftir;
|
||||||
|
rec->next = NULL;
|
||||||
|
rec->dfl_name = PsGetFontName(pFont);
|
||||||
|
rec->size = PsGetFontSize(pFont, rec->mtx);
|
||||||
|
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "PsCreateFontInfoRec: Created PsFontInfoRec '%s'\n",
|
||||||
|
((rec->dfl_name)?(rec->dfl_name):("<null>")));
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
PsFontInfoRec *PsGetFontInfoRec(DrawablePtr pDrawable, FontPtr pFont)
|
||||||
|
{
|
||||||
|
PsFontInfoRec *rec;
|
||||||
|
|
||||||
|
rec = PsFindFontInfoRec(pDrawable, pFont);
|
||||||
|
if (rec)
|
||||||
|
return rec;
|
||||||
|
|
||||||
|
rec = PsCreateFontInfoRec(pDrawable, pFont);
|
||||||
|
if (!rec)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
PsAddFontInfoRec(pDrawable, rec);
|
||||||
|
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PsFreeFontInfoRecords( PsContextPrivPtr priv )
|
||||||
|
{
|
||||||
|
PsFontInfoRec *curr, *next;
|
||||||
|
curr = priv->fontInfoRecords;
|
||||||
|
while( curr != NULL )
|
||||||
|
{
|
||||||
|
next = curr->next;
|
||||||
|
xfree(curr);
|
||||||
|
curr = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
PsFreeFontTypeInfoRecords(priv);
|
||||||
|
|
||||||
|
priv->fontTypeInfoRecords = NULL;
|
||||||
|
priv->fontInfoRecords = NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
* or other dealings in this Software without prior written authorization
|
* or other dealings in this Software without prior written authorization
|
||||||
* from said copyright holders.
|
* from said copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsGC.c,v 1.6tsi Exp $ */
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
**
|
**
|
||||||
|
@ -171,6 +170,26 @@ PsGetDrawablePrivateStuff(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PsContextPrivPtr
|
||||||
|
PsGetPsContextPriv( DrawablePtr pDrawable )
|
||||||
|
{
|
||||||
|
XpContextPtr pCon;
|
||||||
|
PsContextPrivPtr cPriv;
|
||||||
|
|
||||||
|
switch(pDrawable->type)
|
||||||
|
{
|
||||||
|
case DRAWABLE_PIXMAP:
|
||||||
|
return FALSE;
|
||||||
|
case DRAWABLE_WINDOW:
|
||||||
|
pCon = PsGetContextFromWindow((WindowPtr)pDrawable);
|
||||||
|
if (pCon != NULL)
|
||||||
|
{
|
||||||
|
return pCon->devPrivates[PsContextPrivateIndex].ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PsUpdateDrawableGC(
|
PsUpdateDrawableGC(
|
||||||
GCPtr pGC,
|
GCPtr pGC,
|
||||||
|
@ -181,6 +200,7 @@ PsUpdateDrawableGC(
|
||||||
GC dGC;
|
GC dGC;
|
||||||
unsigned long valid;
|
unsigned long valid;
|
||||||
int i;
|
int i;
|
||||||
|
PsContextPrivPtr cPriv;
|
||||||
BoxPtr boxes;
|
BoxPtr boxes;
|
||||||
|
|
||||||
if (!PsGetDrawablePrivateStuff(pDrawable, &dGC, &valid, psOut, cMap))
|
if (!PsGetDrawablePrivateStuff(pDrawable, &dGC, &valid, psOut, cMap))
|
||||||
|
@ -232,6 +252,8 @@ PsUpdateDrawableGC(
|
||||||
PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
|
PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
|
||||||
PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
|
PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
|
||||||
}
|
}
|
||||||
|
cPriv = ( PsGetContextFromWindow( (WindowPtr)pDrawable ) )
|
||||||
|
->devPrivates[PsContextPrivateIndex].ptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -73,7 +73,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsInit.c,v 1.13tsi Exp $ */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -109,8 +108,12 @@ InitializePsDriver(ndx, pScreen, argc, argv)
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
int maxXres, maxYres, maxWidth, maxHeight;
|
||||||
|
int maxRes, maxDim, numBytes;
|
||||||
PsScreenPrivPtr pPriv;
|
PsScreenPrivPtr pPriv;
|
||||||
#endif
|
#endif
|
||||||
|
char **printerNames;
|
||||||
|
int numPrinters;
|
||||||
int nVisuals;
|
int nVisuals;
|
||||||
int nDepths;
|
int nDepths;
|
||||||
VisualPtr visuals;
|
VisualPtr visuals;
|
||||||
|
@ -188,7 +191,7 @@ InitializePsDriver(ndx, pScreen, argc, argv)
|
||||||
|
|
||||||
visuals[1].vid = FakeClientID(0);
|
visuals[1].vid = FakeClientID(0);
|
||||||
visuals[1].class = PseudoColor;
|
visuals[1].class = PseudoColor;
|
||||||
visuals[1].bitsPerRGBValue = 0;
|
visuals[1].bitsPerRGBValue = 8;
|
||||||
visuals[1].ColormapEntries = 256;
|
visuals[1].ColormapEntries = 256;
|
||||||
visuals[1].nplanes = 8;
|
visuals[1].nplanes = 8;
|
||||||
visuals[1].redMask = 0x0;
|
visuals[1].redMask = 0x0;
|
||||||
|
@ -311,11 +314,16 @@ PsInitContext(pCon)
|
||||||
pConPriv =
|
pConPriv =
|
||||||
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
||||||
|
|
||||||
|
memset(pConPriv, 0, sizeof(PsContextPrivRec));
|
||||||
pConPriv->jobFileName = (char *)NULL;
|
pConPriv->jobFileName = (char *)NULL;
|
||||||
pConPriv->pJobFile = (FILE *)NULL;
|
pConPriv->pJobFile = (FILE *)NULL;
|
||||||
|
pConPriv->dash = (unsigned char *)NULL;
|
||||||
|
pConPriv->validGC = 0;
|
||||||
pConPriv->getDocClient = (ClientPtr)NULL;
|
pConPriv->getDocClient = (ClientPtr)NULL;
|
||||||
pConPriv->getDocBufSize = 0;
|
pConPriv->getDocBufSize = 0;
|
||||||
|
pConPriv->pPsOut = NULL;
|
||||||
|
pConPriv->fontInfoRecords = NULL;
|
||||||
|
pConPriv->fontTypeInfoRecords = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* document-attributes-supported
|
* document-attributes-supported
|
||||||
|
@ -388,6 +396,11 @@ PsDestroyContext(pCon)
|
||||||
pConPriv->jobFileName = (char *)NULL;
|
pConPriv->jobFileName = (char *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PsFreeFontInfoRecords(pConPriv);
|
||||||
|
|
||||||
|
/* Reset context to make sure we do not use any stale/invalid/obsolete data */
|
||||||
|
memset(pConPriv, 0, sizeof(PsContextPrivRec));
|
||||||
|
|
||||||
/*### free up visuals/depths ###*/
|
/*### free up visuals/depths ###*/
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
@ -73,7 +73,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsLine.c,v 1.5 2001/01/17 22:36:32 dawes Exp $ */
|
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
#include "gcstruct.h"
|
#include "gcstruct.h"
|
||||||
|
|
|
@ -73,7 +73,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsMisc.c,v 1.5 2001/01/17 22:36:32 dawes Exp $ */
|
|
||||||
|
|
||||||
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
|
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -73,7 +73,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixel.c,v 1.5 2001/01/17 22:36:32 dawes Exp $ */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ in this Software without prior written authorization from The Open Group.
|
||||||
* or other dealings in this Software without prior written authorization
|
* or other dealings in this Software without prior written authorization
|
||||||
* from said copyright holders.
|
* from said copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixmap.c,v 1.4 2001/01/17 22:36:32 dawes Exp $ */
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
**
|
**
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
|
@ -79,6 +79,10 @@ in this Software without prior written authorization from The Open Group.
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
|
|
||||||
|
#define BitsPerPixel(d) (\
|
||||||
|
(1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
|
||||||
|
(PixmapWidthPaddingInfo[d].padRoundUp+1))
|
||||||
|
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
PsCreatePixmap(
|
PsCreatePixmap(
|
||||||
ScreenPtr pScreen,
|
ScreenPtr pScreen,
|
||||||
|
@ -199,7 +203,7 @@ PsGetFreeDisplayBlock(PsPixmapPrivPtr priv)
|
||||||
return(disp);
|
return(disp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable)
|
PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
switch(elm->type)
|
switch(elm->type)
|
||||||
|
@ -488,8 +492,6 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
|
||||||
case PolyFillArcCmd:
|
case PolyFillArcCmd:
|
||||||
*nElms += elm->c.arcs.nArcs;
|
*nElms += elm->c.arcs.nArcs;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,8 +554,6 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
|
||||||
*nElms += 1;
|
*nElms += 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPolygon.c,v 1.6 2001/01/17 22:36:32 dawes Exp $ */
|
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
#include "gcstruct.h"
|
#include "gcstruct.h"
|
||||||
|
@ -176,7 +175,8 @@ PsFillPolygon(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
|
i = 0;
|
||||||
|
pts[0].x = pPoints[i].x; pts[0].y = pPoints[i].y;
|
||||||
for( i=1 ; i<nPoints ; i++ )
|
for( i=1 ; i<nPoints ; i++ )
|
||||||
{
|
{
|
||||||
pts[i].x = pts[i-1].x+pPoints[i].x;
|
pts[i].x = pts[i-1].x+pPoints[i].x;
|
||||||
|
|
|
@ -73,7 +73,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPrint.c,v 1.10 2001/12/14 19:59:17 dawes Exp $ */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -91,6 +90,7 @@ in this Software without prior written authorization from The Open Group.
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
|
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
|
#include "attributes.h"
|
||||||
#include "Oid.h"
|
#include "Oid.h"
|
||||||
|
|
||||||
/* static utility function to get document/page attributes */
|
/* static utility function to get document/page attributes */
|
||||||
|
@ -207,6 +207,8 @@ PsEndJob(
|
||||||
xfree(priv->jobFileName);
|
xfree(priv->jobFileName);
|
||||||
priv->jobFileName = (char *)NULL;
|
priv->jobFileName = (char *)NULL;
|
||||||
|
|
||||||
|
PsFreeFontInfoRecords(priv);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +216,7 @@ PsEndJob(
|
||||||
* Append any trailing information here
|
* Append any trailing information here
|
||||||
*/
|
*/
|
||||||
PsOut_EndFile(priv->pPsOut, 0);
|
PsOut_EndFile(priv->pPsOut, 0);
|
||||||
|
priv->pPsOut = NULL;
|
||||||
|
|
||||||
/* this is where we find out if we're out of space */
|
/* this is where we find out if we're out of space */
|
||||||
error = (fclose(priv->pJobFile) == EOF);
|
error = (fclose(priv->pJobFile) == EOF);
|
||||||
|
@ -233,6 +236,8 @@ PsEndJob(
|
||||||
xfree(priv->jobFileName);
|
xfree(priv->jobFileName);
|
||||||
priv->jobFileName = (char *)NULL;
|
priv->jobFileName = (char *)NULL;
|
||||||
|
|
||||||
|
PsFreeFontInfoRecords(priv);
|
||||||
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +270,8 @@ PsEndJob(
|
||||||
xfree(priv->jobFileName);
|
xfree(priv->jobFileName);
|
||||||
priv->jobFileName = (char *)NULL;
|
priv->jobFileName = (char *)NULL;
|
||||||
|
|
||||||
|
PsFreeFontInfoRecords(priv);
|
||||||
|
|
||||||
#ifdef BM_CACHE
|
#ifdef BM_CACHE
|
||||||
PsBmClearImageCache();
|
PsBmClearImageCache();
|
||||||
#endif
|
#endif
|
||||||
|
@ -281,10 +288,13 @@ PsStartPage(
|
||||||
{
|
{
|
||||||
int iorient, iplex, icount, ires;
|
int iorient, iplex, icount, ires;
|
||||||
unsigned short iwd, iht;
|
unsigned short iwd, iht;
|
||||||
|
register WindowPtr pChild;
|
||||||
PsContextPrivPtr pConPriv =
|
PsContextPrivPtr pConPriv =
|
||||||
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
||||||
PsWindowPrivPtr pWinPriv =
|
PsWindowPrivPtr pWinPriv =
|
||||||
(PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
|
(PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
|
||||||
|
char s[80];
|
||||||
|
xEvent event;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Put a pointer to the context in the window private structure
|
* Put a pointer to the context in the window private structure
|
||||||
|
@ -298,9 +308,16 @@ PsStartPage(
|
||||||
* Start the page
|
* Start the page
|
||||||
*/
|
*/
|
||||||
if (pConPriv->pPsOut == NULL) {
|
if (pConPriv->pPsOut == NULL) {
|
||||||
|
char *title;
|
||||||
|
|
||||||
|
/* get job level attributes */
|
||||||
|
title = XpGetOneAttribute(pCon, XPJobAttr, "job-name");
|
||||||
|
|
||||||
pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile,
|
pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile,
|
||||||
iorient, icount, iplex, ires,
|
title, iorient, icount, iplex, ires,
|
||||||
(int)iwd, (int)iht, False);
|
(int)iwd, (int)iht, False);
|
||||||
|
pConPriv->fontInfoRecords = NULL;
|
||||||
|
pConPriv->fontTypeInfoRecords = NULL;
|
||||||
}
|
}
|
||||||
PsOut_BeginPage(pConPriv->pPsOut, iorient, icount, iplex, ires,
|
PsOut_BeginPage(pConPriv->pPsOut, iorient, icount, iplex, ires,
|
||||||
(int)iwd, (int)iht);
|
(int)iwd, (int)iht);
|
||||||
|
@ -348,15 +365,22 @@ PsStartDoc(XpContextPtr pCon, XPDocumentType type)
|
||||||
{
|
{
|
||||||
int iorient, iplex, icount, ires;
|
int iorient, iplex, icount, ires;
|
||||||
unsigned short iwd, iht;
|
unsigned short iwd, iht;
|
||||||
|
char *title;
|
||||||
PsContextPrivPtr pConPriv =
|
PsContextPrivPtr pConPriv =
|
||||||
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
|
||||||
|
|
||||||
|
/* get job level attributes */
|
||||||
|
title = XpGetOneAttribute(pCon, XPJobAttr, "job-name");
|
||||||
|
|
||||||
/* get document level attributes */
|
/* get document level attributes */
|
||||||
S_GetPageAttributes(pCon,&iorient,&icount,&iplex,&ires,&iwd,&iht);
|
S_GetPageAttributes(pCon,&iorient,&icount,&iplex,&ires,&iwd,&iht);
|
||||||
|
|
||||||
pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile,
|
pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile,
|
||||||
iorient, icount, iplex, ires,
|
title, iorient, icount, iplex, ires,
|
||||||
(int)iwd, (int)iht, (type == XPDocRaw));
|
(int)iwd, (int)iht, (Bool)(type == XPDocRaw));
|
||||||
|
|
||||||
|
pConPriv->fontInfoRecords = NULL;
|
||||||
|
pConPriv->fontTypeInfoRecords = NULL;
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -391,8 +415,11 @@ PsDocumentData(
|
||||||
PsContextPrivPtr cPriv;
|
PsContextPrivPtr cPriv;
|
||||||
PsOutPtr psOut;
|
PsOutPtr psOut;
|
||||||
|
|
||||||
if (len_fmt != 12 || !strcmp(pFmt, "PostScript 2") || len_opt)
|
if (len_fmt != 12 ||
|
||||||
|
strncasecmp(pFmt, "PostScript 2", len_fmt) != 0 ||
|
||||||
|
len_opt)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr;
|
cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr;
|
||||||
psOut = cPriv->pPsOut;
|
psOut = cPriv->pPsOut;
|
||||||
|
|
||||||
|
|
|
@ -73,49 +73,13 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsText.c,v 1.12tsi Exp $ */
|
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
#include "gcstruct.h"
|
#include "gcstruct.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
|
#include "fntfil.h"
|
||||||
#include "fntfilst.h"
|
#include "fntfilst.h"
|
||||||
#include <sys/stat.h>
|
#include <limits.h>
|
||||||
|
|
||||||
static int readFontName(char *fileName, char *file_name, char *dlfnam)
|
|
||||||
{
|
|
||||||
FILE *file;
|
|
||||||
struct stat statb;
|
|
||||||
char buf[256];
|
|
||||||
char *front, *fn;
|
|
||||||
|
|
||||||
file = fopen(fileName, "r");
|
|
||||||
if(file)
|
|
||||||
{
|
|
||||||
if (fstat (fileno(file), &statb) == -1)
|
|
||||||
return 0;
|
|
||||||
while(fgets(buf, 255, file))
|
|
||||||
{
|
|
||||||
if((fn = strstr(buf, " -")))
|
|
||||||
{
|
|
||||||
strcpy(file_name, buf);
|
|
||||||
file_name[fn - buf - 4] = '\0';
|
|
||||||
fn++;
|
|
||||||
if((front = strstr(fn, "normal-")))
|
|
||||||
{
|
|
||||||
fn[front - fn] = '\0';
|
|
||||||
if(strstr(dlfnam, fn))
|
|
||||||
{
|
|
||||||
fclose(file);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_name[0] = '\0';
|
|
||||||
fclose(file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PsPolyText8(
|
PsPolyText8(
|
||||||
|
@ -147,40 +111,79 @@ PsPolyText8(
|
||||||
elm->c.text8.string = (char *)xalloc(count);
|
elm->c.text8.string = (char *)xalloc(count);
|
||||||
memcpy(elm->c.text8.string, string, count);
|
memcpy(elm->c.text8.string, string, count);
|
||||||
disp->nelms += 1;
|
disp->nelms += 1;
|
||||||
|
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *fnam, ffname[512], *dlfnam;
|
PsFontInfoRec *firec;
|
||||||
FontDirectoryPtr dir;
|
|
||||||
char file_name[MAXFONTNAMELEN];
|
|
||||||
|
|
||||||
dir = pGC->font->fpe->private;
|
/* We need a context for rendering... */
|
||||||
sprintf(ffname, "%s%s", dir->directory, "fonts.dir");
|
if (PsGetPsContextPriv(pDrawable) == NULL)
|
||||||
|
|
||||||
fnam = PsGetPSFontName(pGC->font);
|
|
||||||
if(!fnam){
|
|
||||||
if(!(dlfnam = PsGetFontName(pGC->font)))
|
|
||||||
return x;
|
return x;
|
||||||
/* If Type1 font, try to download to printer first */
|
|
||||||
if(strstr(ffname, "Type1") && readFontName(ffname, file_name, dlfnam))
|
firec = PsGetFontInfoRec(pDrawable, pGC->font);
|
||||||
|
if (!firec)
|
||||||
|
return x;
|
||||||
|
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
if (firec->ftir->downloadableFont &&
|
||||||
|
(firec->ftir->font_type == PSFTI_FONT_TYPE_FREETYPE))
|
||||||
{
|
{
|
||||||
int siz;
|
|
||||||
float mtx[4];
|
|
||||||
PsOutPtr psOut;
|
PsOutPtr psOut;
|
||||||
ColormapPtr cMap;
|
ColormapPtr cMap;
|
||||||
|
|
||||||
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
|
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
|
||||||
return x;
|
return x;
|
||||||
sprintf(ffname, "%s%s%s", dir->directory, file_name, ".pfa");
|
|
||||||
PsOut_DownloadType1(psOut, file_name, ffname);
|
if (firec->ftir->alreadyDownloaded[0] == False)
|
||||||
|
{
|
||||||
|
PsOut_DownloadFreeType(psOut,
|
||||||
|
firec->ftir->ft_download_font_type,
|
||||||
|
firec->ftir->download_ps_name, pGC->font, 0);
|
||||||
|
firec->ftir->alreadyDownloaded[0] = True;
|
||||||
|
}
|
||||||
|
|
||||||
PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
|
PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
|
||||||
PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
|
PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
|
||||||
siz = PsGetFontSize(pGC->font, mtx);
|
if (!firec->size)
|
||||||
if( !siz ) PsOut_TextAttrsMtx(psOut, file_name, mtx, 1);
|
PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
|
||||||
else PsOut_TextAttrs(psOut, file_name, siz, 1);
|
else
|
||||||
PsOut_Text(psOut, x, y, string, count, -1);
|
PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
|
||||||
|
PsOut_FreeType_Text(pGC->font, psOut, x, y, string, count);
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
if (firec->ftir->downloadableFont &&
|
||||||
|
(firec->ftir->font_type != PSFTI_FONT_TYPE_FREETYPE))
|
||||||
|
{
|
||||||
|
PsOutPtr psOut;
|
||||||
|
ColormapPtr cMap;
|
||||||
|
|
||||||
|
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
|
||||||
|
return x;
|
||||||
|
|
||||||
|
if (firec->ftir->alreadyDownloaded[0] == False)
|
||||||
|
{
|
||||||
|
PsOut_DownloadType1(psOut, "PsPolyText8",
|
||||||
|
firec->ftir->download_ps_name, firec->ftir->filename);
|
||||||
|
firec->ftir->alreadyDownloaded[0] = True;
|
||||||
|
}
|
||||||
|
|
||||||
|
PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
|
||||||
|
PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
|
||||||
|
if (!firec->size)
|
||||||
|
PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
|
||||||
|
else
|
||||||
|
PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
|
||||||
|
PsOut_Text(psOut, x, y, string, count, -1);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Render glyphs as bitmaps */
|
||||||
{
|
{
|
||||||
unsigned long n, i;
|
unsigned long n, i;
|
||||||
int w;
|
int w;
|
||||||
|
@ -189,27 +192,15 @@ PsPolyText8(
|
||||||
GetGlyphs(pGC->font, (unsigned long)count,
|
GetGlyphs(pGC->font, (unsigned long)count,
|
||||||
(unsigned char *)string, Linear8Bit, &n, charinfo);
|
(unsigned char *)string, Linear8Bit, &n, charinfo);
|
||||||
w = 0;
|
w = 0;
|
||||||
for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
|
for (i=0; i < n; i++)
|
||||||
|
w += charinfo[i]->metrics.characterWidth;
|
||||||
|
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
PsPolyGlyphBlt(pDrawable, pGC, x, y, n,
|
PsPolyGlyphBlt(pDrawable, pGC, x, y, n,
|
||||||
charinfo, FONTGLYPHS(pGC->font));
|
charinfo, FONTGLYPHS(pGC->font));
|
||||||
x += w;
|
x += w;
|
||||||
}
|
|
||||||
}else{
|
|
||||||
int iso;
|
|
||||||
int siz;
|
|
||||||
float mtx[4];
|
|
||||||
PsOutPtr psOut;
|
|
||||||
ColormapPtr cMap;
|
|
||||||
|
|
||||||
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return x;
|
return x;
|
||||||
PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
|
|
||||||
PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
|
|
||||||
siz = PsGetFontSize(pGC->font, mtx);
|
|
||||||
iso = PsIsISOLatin1Encoding(pGC->font);
|
|
||||||
if( !siz ) PsOut_TextAttrsMtx(psOut, fnam, mtx, iso);
|
|
||||||
else PsOut_TextAttrs(psOut, fnam, siz, iso);
|
|
||||||
PsOut_Text(psOut, x, y, string, count, -1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
|
@ -246,8 +237,119 @@ PsPolyText16(
|
||||||
(unsigned short *)xalloc(count*sizeof(unsigned short));
|
(unsigned short *)xalloc(count*sizeof(unsigned short));
|
||||||
memcpy(elm->c.text16.string, string, count*sizeof(unsigned short));
|
memcpy(elm->c.text16.string, string, count*sizeof(unsigned short));
|
||||||
disp->nelms += 1;
|
disp->nelms += 1;
|
||||||
|
|
||||||
|
return x;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
PsFontInfoRec *firec;
|
||||||
|
|
||||||
|
/* We need a context for rendering... */
|
||||||
|
if (PsGetPsContextPriv(pDrawable) == NULL)
|
||||||
|
return x;
|
||||||
|
|
||||||
|
firec = PsGetFontInfoRec(pDrawable, pGC->font);
|
||||||
|
if (!firec)
|
||||||
|
return x;
|
||||||
|
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
if (firec->ftir->downloadableFont &&
|
||||||
|
(firec->ftir->font_type == PSFTI_FONT_TYPE_FREETYPE))
|
||||||
|
{
|
||||||
|
PsOutPtr psOut;
|
||||||
|
ColormapPtr cMap;
|
||||||
|
unsigned short c,
|
||||||
|
c_hiByte,
|
||||||
|
c_lowByte,
|
||||||
|
fontPage;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
|
||||||
|
return x;
|
||||||
|
|
||||||
|
/* Scan the string we want to render and download all neccesary parts
|
||||||
|
* of the font (one part(="font page") has 256 glyphs)
|
||||||
|
*/
|
||||||
|
for( i = 0 ; i < count ; i++ )
|
||||||
|
{
|
||||||
|
c = string[i];
|
||||||
|
#if IMAGE_BYTE_ORDER == LSBFirst
|
||||||
|
c_hiByte = c & 0x00FF;
|
||||||
|
c_lowByte = (c >> 8) & 0x00FF;
|
||||||
|
#elif IMAGE_BYTE_ORDER == MSBFirst
|
||||||
|
c_hiByte = (c >> 8) & 0x00FF;
|
||||||
|
c_lowByte = c & 0x00FF;
|
||||||
|
#else
|
||||||
|
#error Unsupported byte order
|
||||||
|
#endif
|
||||||
|
fontPage = c_hiByte;
|
||||||
|
|
||||||
|
if (firec->ftir->alreadyDownloaded[fontPage] == False)
|
||||||
|
{
|
||||||
|
char buffer[256];
|
||||||
|
const char *ps_name;
|
||||||
|
|
||||||
|
if (fontPage > 0)
|
||||||
|
{
|
||||||
|
sprintf(buffer, "%s_%x", firec->ftir->download_ps_name, (int)fontPage);
|
||||||
|
ps_name = buffer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ps_name = firec->ftir->download_ps_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
PsOut_DownloadFreeType(psOut,
|
||||||
|
firec->ftir->ft_download_font_type,
|
||||||
|
ps_name, pGC->font, (fontPage * 0x100)); /* same as (fontPage << 8) */
|
||||||
|
|
||||||
|
firec->ftir->alreadyDownloaded[fontPage] = True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
|
||||||
|
PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
|
||||||
|
if (!firec->size)
|
||||||
|
PsOut_FreeType_TextAttrsMtx16(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
|
||||||
|
else
|
||||||
|
PsOut_FreeType_TextAttrs16(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
|
||||||
|
PsOut_FreeType_Text16(pGC->font, psOut, x, y, string, count);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
if (firec->ftir->downloadableFont &&
|
||||||
|
(firec->ftir->font_type != PSFTI_FONT_TYPE_FREETYPE))
|
||||||
|
{
|
||||||
|
PsOutPtr psOut;
|
||||||
|
ColormapPtr cMap;
|
||||||
|
unsigned short c,
|
||||||
|
c_hiByte,
|
||||||
|
c_lowByte,
|
||||||
|
fontPage;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE )
|
||||||
|
return x;
|
||||||
|
|
||||||
|
PsOut_DownloadType1(psOut, "PsPolyText16",
|
||||||
|
firec->ftir->download_ps_name, firec->ftir->filename);
|
||||||
|
firec->ftir->alreadyDownloaded[fontPage] = True;
|
||||||
|
|
||||||
|
PsOut_Offset(psOut, pDrawable->x, pDrawable->y);
|
||||||
|
PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel));
|
||||||
|
if (!firec->size)
|
||||||
|
PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding);
|
||||||
|
else
|
||||||
|
PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding);
|
||||||
|
PsOut_Text16(psOut, x, y, string, count, -1);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Render glyphs as bitmaps */
|
||||||
{
|
{
|
||||||
unsigned long n, i;
|
unsigned long n, i;
|
||||||
int w;
|
int w;
|
||||||
|
@ -257,10 +359,14 @@ PsPolyText16(
|
||||||
(FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
|
(FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
|
||||||
&n, charinfo);
|
&n, charinfo);
|
||||||
w = 0;
|
w = 0;
|
||||||
for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
|
for (i=0; i < n; i++)
|
||||||
|
w += charinfo[i]->metrics.characterWidth;
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
PsPolyGlyphBlt(pDrawable, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
|
PsPolyGlyphBlt(pDrawable, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
|
||||||
x += w;
|
x += w;
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
@ -386,7 +492,7 @@ PsPolyGlyphBlt(
|
||||||
pointer pGlyphBase)
|
pointer pGlyphBase)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
PixmapPtr pPixmap = NullPixmap;
|
PixmapPtr pPixmap;
|
||||||
int nbyLine; /* bytes per line of padded pixmap */
|
int nbyLine; /* bytes per line of padded pixmap */
|
||||||
FontPtr pfont;
|
FontPtr pfont;
|
||||||
GCPtr pGCtmp;
|
GCPtr pGCtmp;
|
||||||
|
@ -399,7 +505,7 @@ PsPolyGlyphBlt(
|
||||||
int gWidth, gHeight; /* width and height of glyph */
|
int gWidth, gHeight; /* width and height of glyph */
|
||||||
register int nbyGlyphWidth; /* bytes per scanline of glyph */
|
register int nbyGlyphWidth; /* bytes per scanline of glyph */
|
||||||
int nbyPadGlyph; /* server padded line of glyph */
|
int nbyPadGlyph; /* server padded line of glyph */
|
||||||
int w;
|
int w, tmpx;
|
||||||
XID gcvals[3];
|
XID gcvals[3];
|
||||||
|
|
||||||
pfont = pGC->font;
|
pfont = pGC->font;
|
||||||
|
@ -435,6 +541,7 @@ PsPolyGlyphBlt(
|
||||||
PsDestroyPixmap(pPixmap);
|
PsDestroyPixmap(pPixmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
tmpx = 0;
|
||||||
while(nGlyphs--)
|
while(nGlyphs--)
|
||||||
{
|
{
|
||||||
pci = *pCharInfo++;
|
pci = *pCharInfo++;
|
||||||
|
@ -466,8 +573,9 @@ PsPolyGlyphBlt(
|
||||||
1, x + pci->metrics.leftSideBearing,
|
1, x + pci->metrics.leftSideBearing,
|
||||||
y - pci->metrics.ascent, gWidth, gHeight,
|
y - pci->metrics.ascent, gWidth, gHeight,
|
||||||
0, XYBitmap, (char *)pb);
|
0, XYBitmap, (char *)pb);
|
||||||
x += pci->metrics.characterWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x += pci->metrics.characterWidth;
|
||||||
}
|
}
|
||||||
DEALLOCATE_LOCAL(pbits);
|
DEALLOCATE_LOCAL(pbits);
|
||||||
FreeScratchGC(pGCtmp);
|
FreeScratchGC(pGCtmp);
|
||||||
|
|
|
@ -73,11 +73,9 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsWindow.c,v 1.12tsi Exp $ */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include "mistruct.h"
|
#include "mistruct.h"
|
||||||
|
@ -87,7 +85,8 @@ in this Software without prior written authorization from The Open Group.
|
||||||
|
|
||||||
#include "Ps.h"
|
#include "Ps.h"
|
||||||
|
|
||||||
#if 0
|
extern WindowPtr *WindowTable;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following list of strings defines the properties which will be
|
* The following list of strings defines the properties which will be
|
||||||
* placed on the screen's root window if the property was defined in
|
* placed on the screen's root window if the property was defined in
|
||||||
|
@ -104,7 +103,7 @@ static char *propStrings[] = {
|
||||||
DT_PRINT_PAGE_COMMAND,
|
DT_PRINT_PAGE_COMMAND,
|
||||||
(char *)NULL
|
(char *)NULL
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PsCreateWindow - watch for the creation of the root window.
|
* PsCreateWindow - watch for the creation of the root window.
|
||||||
|
@ -219,6 +218,8 @@ PsPaintWindow(
|
||||||
RegionPtr pRegion,
|
RegionPtr pRegion,
|
||||||
int what)
|
int what)
|
||||||
{
|
{
|
||||||
|
int status;
|
||||||
|
WindowPtr pRoot;
|
||||||
|
|
||||||
#define FUNCTION 0
|
#define FUNCTION 0
|
||||||
#define FOREGROUND 1
|
#define FOREGROUND 1
|
||||||
|
@ -298,6 +299,7 @@ PsPaintWindow(
|
||||||
gcmask |= GCFunction | GCClipMask;
|
gcmask |= GCFunction | GCClipMask;
|
||||||
|
|
||||||
i = pScreen->myNum;
|
i = pScreen->myNum;
|
||||||
|
pRoot = WindowTable[i];
|
||||||
|
|
||||||
pBgWin = pWin;
|
pBgWin = pWin;
|
||||||
if (what == PW_BORDER)
|
if (what == PW_BORDER)
|
||||||
|
@ -375,14 +377,14 @@ PsPaintWindow(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GCClipMask:
|
case GCClipMask:
|
||||||
if( (pointer)(long)pGC->clientClipType!=(pointer)CT_NONE )
|
if( (pointer)pGC->clientClipType!=(pointer)CT_NONE )
|
||||||
{
|
{
|
||||||
gcmask |= index;
|
gcmask |= index;
|
||||||
gcval[i++] = (pointer)CT_NONE;
|
gcval[i++] = (pointer)CT_NONE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GCSubwindowMode:
|
case GCSubwindowMode:
|
||||||
if( (pointer)(long)pGC->subWindowMode!=newValues[SUBWINDOW] )
|
if( (pointer)pGC->subWindowMode!=newValues[SUBWINDOW] )
|
||||||
{
|
{
|
||||||
gcmask |= index;
|
gcmask |= index;
|
||||||
gcval[i++] = newValues[SUBWINDOW];
|
gcval[i++] = newValues[SUBWINDOW];
|
||||||
|
@ -396,7 +398,7 @@ PsPaintWindow(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GCFillStyle:
|
case GCFillStyle:
|
||||||
if( (pointer)(long)pGC->fillStyle!=newValues[FILLSTYLE] )
|
if( (pointer)pGC->fillStyle!=newValues[FILLSTYLE] )
|
||||||
{
|
{
|
||||||
gcmask |= index;
|
gcmask |= index;
|
||||||
gcval[i++] = newValues[FILLSTYLE];
|
gcval[i++] = newValues[FILLSTYLE];
|
||||||
|
|
|
@ -73,79 +73,17 @@ in this Software without prior written authorization from The Open Group.
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
**
|
**
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.c,v 1.11 2001/12/19 21:55:59 dawes Exp $ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For XFree86 3.3.3:
|
|
||||||
*
|
|
||||||
* As a *quick* way of preventing some buffers overflowing onto the stack,
|
|
||||||
* they have been made static. There are potential problems with
|
|
||||||
* PsOutRec.Buf overflowing too which should be investigated as part of a
|
|
||||||
* review of this code, but that is at least always allocated with malloc
|
|
||||||
* and shouldn't pose an immediate stack trashing problem.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "Ps.h"
|
#define USE_PSOUT_PRIVATE 1
|
||||||
#include "psout.h"
|
#include "psout.h"
|
||||||
|
/* For VENDOR_STRING and VENDOR_RELEASE */
|
||||||
|
#include "site.h"
|
||||||
|
|
||||||
typedef void *voidPtr;
|
extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
|
||||||
|
extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
|
||||||
typedef struct PsPatRec_
|
|
||||||
{
|
|
||||||
PsFillEnum type;
|
|
||||||
voidPtr tag;
|
|
||||||
} PsPatRec;
|
|
||||||
|
|
||||||
typedef PsPatRec *PsPatPtr;
|
|
||||||
|
|
||||||
typedef struct PsOutRec_
|
|
||||||
{
|
|
||||||
FILE *Fp;
|
|
||||||
char Buf[256];
|
|
||||||
int CurColor;
|
|
||||||
int LineWidth;
|
|
||||||
PsCapEnum LineCap;
|
|
||||||
PsJoinEnum LineJoin;
|
|
||||||
int NDashes;
|
|
||||||
int *Dashes;
|
|
||||||
int DashOffset;
|
|
||||||
int LineBClr;
|
|
||||||
PsRuleEnum FillRule;
|
|
||||||
char *FontName;
|
|
||||||
int FontSize;
|
|
||||||
float FontMtx[4];
|
|
||||||
int ImageFormat;
|
|
||||||
int RevImage;
|
|
||||||
int NPatterns;
|
|
||||||
int MxPatterns;
|
|
||||||
PsPatPtr Patterns;
|
|
||||||
int ClipType;
|
|
||||||
PsClipRec Clip;
|
|
||||||
int InFrame;
|
|
||||||
int XOff;
|
|
||||||
int YOff;
|
|
||||||
|
|
||||||
PsFillEnum InTile;
|
|
||||||
int ImgSkip;
|
|
||||||
int ImgBClr;
|
|
||||||
int ImgFClr;
|
|
||||||
int ImgX;
|
|
||||||
int ImgY;
|
|
||||||
int ImgW;
|
|
||||||
int ImgH;
|
|
||||||
int SclW;
|
|
||||||
int SclH;
|
|
||||||
|
|
||||||
int NDownloads;
|
|
||||||
int MxDownloads;
|
|
||||||
char **Downloads;
|
|
||||||
Bool isRaw;
|
|
||||||
|
|
||||||
int start_image;
|
|
||||||
} PsOutRec;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Standard definitions
|
* Standard definitions
|
||||||
|
@ -174,6 +112,7 @@ static char *S_StandardDefs = "\
|
||||||
/ie{ifelse}bd\
|
/ie{ifelse}bd\
|
||||||
/len{length}bd\
|
/len{length}bd\
|
||||||
/m{moveto}bd\
|
/m{moveto}bd\
|
||||||
|
/rm{rmoveto}bd\
|
||||||
/l{lineto}bd\
|
/l{lineto}bd\
|
||||||
/rl{rlineto}bd\
|
/rl{rlineto}bd\
|
||||||
/a{arc}bd\
|
/a{arc}bd\
|
||||||
|
@ -236,7 +175,11 @@ static char *S_StandardDefs = "\
|
||||||
/mp{makepattern}bd\
|
/mp{makepattern}bd\
|
||||||
/spt{setpattern}bd\
|
/spt{setpattern}bd\
|
||||||
/spd{setpagedevice}bd\
|
/spd{setpagedevice}bd\
|
||||||
";
|
"
|
||||||
|
#ifdef XP_USE_FREETYPE
|
||||||
|
"/trmoveto{currentfont /FontMatrix get transform rm}d"
|
||||||
|
#endif /* XP_USE_FREETYPE */
|
||||||
|
;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Composite definitions
|
* Composite definitions
|
||||||
|
@ -341,7 +284,6 @@ static char *S_CompositeDefs = "\
|
||||||
/mtx{scl t [3 i 0 0 5 i 0 0]}bd \
|
/mtx{scl t [3 i 0 0 5 i 0 0]}bd \
|
||||||
";
|
";
|
||||||
|
|
||||||
int pagenum = 0;
|
|
||||||
char *pg_orient[] = {"Portrait","Landscape","Reverse Portrait","Reverse Landscape"};
|
char *pg_orient[] = {"Portrait","Landscape","Reverse Portrait","Reverse Landscape"};
|
||||||
/*
|
/*
|
||||||
* Setup definitions
|
* Setup definitions
|
||||||
|
@ -360,7 +302,7 @@ static char *S_SetupDefs = "\
|
||||||
* PRIVATE FUNCTIONS *
|
* PRIVATE FUNCTIONS *
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|
||||||
static void
|
void
|
||||||
S_Flush(PsOutPtr self)
|
S_Flush(PsOutPtr self)
|
||||||
{
|
{
|
||||||
if( self->Buf[0] )
|
if( self->Buf[0] )
|
||||||
|
@ -388,7 +330,7 @@ S_OutDefs(PsOutPtr self, char *defs)
|
||||||
{
|
{
|
||||||
int i, k=0;
|
int i, k=0;
|
||||||
S_Flush(self);
|
S_Flush(self);
|
||||||
memset(self->Buf, 0, 256);
|
memset(self->Buf, 0, sizeof(self->Buf));
|
||||||
for( i=0 ; defs[i]!='\0' ;)
|
for( i=0 ; defs[i]!='\0' ;)
|
||||||
{
|
{
|
||||||
if( k>70 && (i==0 || (i && defs[i-1]!='/')) &&
|
if( k>70 && (i==0 || (i && defs[i-1]!='/')) &&
|
||||||
|
@ -396,7 +338,7 @@ S_OutDefs(PsOutPtr self, char *defs)
|
||||||
{
|
{
|
||||||
S_Flush(self);
|
S_Flush(self);
|
||||||
k = 0;
|
k = 0;
|
||||||
memset(self->Buf, 0, 256);
|
memset(self->Buf, 0, sizeof(self->Buf));
|
||||||
}
|
}
|
||||||
if( k && self->Buf[k-1]==' ' && defs[i]==' ' ) { i++; continue; }
|
if( k && self->Buf[k-1]==' ' && defs[i]==' ' ) { i++; continue; }
|
||||||
self->Buf[k] = defs[i];
|
self->Buf[k] = defs[i];
|
||||||
|
@ -405,11 +347,11 @@ S_OutDefs(PsOutPtr self, char *defs)
|
||||||
S_Flush(self);
|
S_Flush(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
S_OutNum(PsOutPtr self, float num)
|
S_OutNum(PsOutPtr self, float num)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static char buf[64];
|
char buf[64];
|
||||||
sprintf(buf, "%.3f", num);
|
sprintf(buf, "%.3f", num);
|
||||||
for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0';
|
for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0';
|
||||||
if( buf[strlen(buf)-1]=='.' ) buf[strlen(buf)-1] = '\0';
|
if( buf[strlen(buf)-1]=='.' ) buf[strlen(buf)-1] = '\0';
|
||||||
|
@ -422,7 +364,7 @@ static void
|
||||||
S_OutStr(PsOutPtr self, char *txt, int txtl)
|
S_OutStr(PsOutPtr self, char *txt, int txtl)
|
||||||
{
|
{
|
||||||
int i, k;
|
int i, k;
|
||||||
static char buf[512];
|
char buf[1024];
|
||||||
for( i=0,k=0 ; i<txtl ; i++ )
|
for( i=0,k=0 ; i<txtl ; i++ )
|
||||||
{
|
{
|
||||||
if( (txt[i]>=' ' && txt[i]<='~') &&
|
if( (txt[i]>=' ' && txt[i]<='~') &&
|
||||||
|
@ -430,7 +372,9 @@ S_OutStr(PsOutPtr self, char *txt, int txtl)
|
||||||
{ buf[k] = txt[i]; k++; continue; }
|
{ buf[k] = txt[i]; k++; continue; }
|
||||||
buf[k] = '\\'; k++;
|
buf[k] = '\\'; k++;
|
||||||
sprintf(&buf[k], "%03o", txt[i]&0xFF);
|
sprintf(&buf[k], "%03o", txt[i]&0xFF);
|
||||||
k += 3;
|
/* Skip to the end of the buffer */
|
||||||
|
while( buf[k] != '\0' )
|
||||||
|
k++;
|
||||||
}
|
}
|
||||||
strcat(self->Buf, "(");
|
strcat(self->Buf, "(");
|
||||||
i = strlen(self->Buf);
|
i = strlen(self->Buf);
|
||||||
|
@ -440,7 +384,32 @@ S_OutStr(PsOutPtr self, char *txt, int txtl)
|
||||||
if( strlen(self->Buf)>70 ) S_Flush(self);
|
if( strlen(self->Buf)>70 ) S_Flush(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Same as S_OutStr() but takes |short *| instead of |char *| */
|
||||||
static void
|
static void
|
||||||
|
S_OutStr16(PsOutPtr self, unsigned short *txt, int txtl)
|
||||||
|
{
|
||||||
|
int i, k;
|
||||||
|
char buf[2048];
|
||||||
|
for( i=0,k=0 ; i<txtl ; i++ )
|
||||||
|
{
|
||||||
|
if( (txt[i]>=' ' && txt[i]<='~') &&
|
||||||
|
txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' )
|
||||||
|
{ buf[k] = txt[i]; k++; continue; }
|
||||||
|
buf[k] = '\\'; k++;
|
||||||
|
sprintf(&buf[k], "%03o", txt[i]&0xFFFF);
|
||||||
|
/* Skip to the end of the buffer */
|
||||||
|
while( buf[k] != '\0' )
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
strcat(self->Buf, "(");
|
||||||
|
i = strlen(self->Buf);
|
||||||
|
memcpy(&self->Buf[i], buf, k);
|
||||||
|
self->Buf[i+k] = '\0';
|
||||||
|
strcat(self->Buf, ")");
|
||||||
|
if( strlen(self->Buf)>70 ) S_Flush(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
S_OutTok(PsOutPtr self, char *tok, int cr)
|
S_OutTok(PsOutPtr self, char *tok, int cr)
|
||||||
{
|
{
|
||||||
if( self->Buf[0] ) strcat(self->Buf, " ");
|
if( self->Buf[0] ) strcat(self->Buf, " ");
|
||||||
|
@ -471,6 +440,27 @@ S_SetPageDevice(PsOutPtr self, int orient, int count, int plex, int res,
|
||||||
float fwd = ((float)wd/(float)res)*72.;
|
float fwd = ((float)wd/(float)res)*72.;
|
||||||
float fht = ((float)ht/(float)res)*72.;
|
float fht = ((float)ht/(float)res)*72.;
|
||||||
|
|
||||||
|
#define USE_WORKAROUND_COPY_COUNT_BUG 1
|
||||||
|
|
||||||
|
#ifdef USE_WORKAROUND_COPY_COUNT_BUG
|
||||||
|
/* Workaround (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1861 -
|
||||||
|
* 'Need workaround for bug 1378 ...') to avoid that we print n^2 copies
|
||||||
|
* instead of n copies.
|
||||||
|
* The problem is that we use both /NumCopies here but pass the
|
||||||
|
* %copy-count% to the spooler, too.
|
||||||
|
* But we only have to use _one_ way...
|
||||||
|
*
|
||||||
|
* The final fix for bug 1378 (http://xprint.mozdev.org/bugs/show_bug.cgi?id=1378 -
|
||||||
|
* "PS DDX creates n^2 copies of a job instead of n copies") will back this
|
||||||
|
* workaround out and replace it with a better solution.
|
||||||
|
* (see mozilla.org bug 140030
|
||||||
|
* (http://bugzilla.mozilla.org/show_bug.cgi?id=140030 - "Setting number
|
||||||
|
* of copies causes too many copies to print") for the initial report for
|
||||||
|
* this issue...)
|
||||||
|
*/
|
||||||
|
count = 1;
|
||||||
|
#endif /* USE_WORKAROUND_COPY_COUNT_BUG */
|
||||||
|
|
||||||
S_OutTok(self, "/pWd", 0);
|
S_OutTok(self, "/pWd", 0);
|
||||||
S_OutNum(self, fwd);
|
S_OutNum(self, fwd);
|
||||||
S_OutTok(self, "d /pHt", 0);
|
S_OutTok(self, "d /pHt", 0);
|
||||||
|
@ -577,10 +567,11 @@ PsOut_ChangeFile(PsOutPtr self, FILE *fp)
|
||||||
}
|
}
|
||||||
|
|
||||||
PsOutPtr
|
PsOutPtr
|
||||||
PsOut_BeginFile(FILE *fp, int orient, int count, int plex, int res,
|
PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex, int res,
|
||||||
int wd, int ht, Bool raw)
|
int wd, int ht, Bool raw)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char buffer[256+32]; /* enougth space for a title with 256 chars... */
|
||||||
/*
|
/*
|
||||||
* Get ready to output PostScript header
|
* Get ready to output PostScript header
|
||||||
*/
|
*/
|
||||||
|
@ -589,15 +580,25 @@ PsOut_BeginFile(FILE *fp, int orient, int count, int plex, int res,
|
||||||
memset(psout, 0, sizeof(PsOutRec));
|
memset(psout, 0, sizeof(PsOutRec));
|
||||||
psout->Fp = fp;
|
psout->Fp = fp;
|
||||||
psout->isRaw = raw;
|
psout->isRaw = raw;
|
||||||
pagenum = 0;
|
psout->pagenum = 0;
|
||||||
|
|
||||||
if (!raw) {
|
if (!raw) {
|
||||||
/*
|
/*
|
||||||
* Output PostScript header
|
* Output PostScript header
|
||||||
*/
|
*/
|
||||||
S_Comment(psout, "%!PS-Adobe-3.0 EPSF-3.0");
|
/* GhostScript will rant about the missing BoundingBox if we use
|
||||||
S_Comment(psout, "%%Creator: The Open Group PostScript Print Server");
|
* "%!PS-Adobe-3.0 EPSF-3.0" here... */
|
||||||
/*### BoundingBox ###*/
|
S_Comment(psout, "%!PS-Adobe-3.0");
|
||||||
|
sprintf(buffer,
|
||||||
|
"%%%%Creator: The X Print Server's PostScript DDX (%s, release %d)",
|
||||||
|
VENDOR_STRING, VENDOR_RELEASE);
|
||||||
|
S_Comment(psout, buffer);
|
||||||
|
|
||||||
|
if (title)
|
||||||
|
{
|
||||||
|
sprintf(buffer, "%%%%Title: %.256s", title);
|
||||||
|
S_Comment(psout, buffer);
|
||||||
|
}
|
||||||
S_Comment(psout, "%%EndComments");
|
S_Comment(psout, "%%EndComments");
|
||||||
S_Comment(psout, "%%BeginProlog");
|
S_Comment(psout, "%%BeginProlog");
|
||||||
S_Comment(psout, "%%BeginProcSet: XServer_PS_Functions");
|
S_Comment(psout, "%%BeginProcSet: XServer_PS_Functions");
|
||||||
|
@ -635,9 +636,12 @@ PsOut_EndFile(PsOutPtr self, int closeFile)
|
||||||
char coms[50];
|
char coms[50];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!self)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!self->isRaw) {
|
if (!self->isRaw) {
|
||||||
S_Comment(self,"%%Trailer");
|
S_Comment(self,"%%Trailer");
|
||||||
sprintf(coms,"%%%%Pages: %d",pagenum);
|
sprintf(coms,"%%%%Pages: %d", self->pagenum);
|
||||||
S_Comment(self, coms);
|
S_Comment(self, coms);
|
||||||
S_Comment(self, "%%EOF");
|
S_Comment(self, "%%EOF");
|
||||||
}
|
}
|
||||||
|
@ -646,9 +650,6 @@ PsOut_EndFile(PsOutPtr self, int closeFile)
|
||||||
if( self->Patterns ) xfree(self->Patterns);
|
if( self->Patterns ) xfree(self->Patterns);
|
||||||
if( self->Clip.rects ) xfree(self->Clip.rects);
|
if( self->Clip.rects ) xfree(self->Clip.rects);
|
||||||
if( closeFile ) fclose(self->Fp);
|
if( closeFile ) fclose(self->Fp);
|
||||||
for( i=0 ; i<self->NDownloads ; i++ ) xfree(self->Downloads[i]);
|
|
||||||
if( self->Downloads ) xfree(self->Downloads);
|
|
||||||
pagenum = 0; /* reset page num back to 0 */
|
|
||||||
xfree(self);
|
xfree(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,8 +662,8 @@ PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex, int res,
|
||||||
/*** comment for pagenumbers *****/
|
/*** comment for pagenumbers *****/
|
||||||
|
|
||||||
S_Comment(self,"%%PageHeader");
|
S_Comment(self,"%%PageHeader");
|
||||||
pagenum++;
|
self->pagenum++;
|
||||||
sprintf(coms,"%%%%Page: %d %d",pagenum,pagenum);
|
sprintf(coms,"%%%%Page: %d %d", self->pagenum, self->pagenum);
|
||||||
S_Comment(self, coms);
|
S_Comment(self, coms);
|
||||||
sprintf(coms,"%%%%PageOrientation: %s",pg_orient[orient]);
|
sprintf(coms,"%%%%PageOrientation: %s",pg_orient[orient]);
|
||||||
S_Comment(self, coms);
|
S_Comment(self, coms);
|
||||||
|
@ -959,7 +960,7 @@ void
|
||||||
PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso)
|
PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static char buf[256];
|
char buf[256];
|
||||||
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
|
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
|
||||||
siz==self->FontSize ) return;
|
siz==self->FontSize ) return;
|
||||||
if( self->FontName ) xfree(self->FontName);
|
if( self->FontName ) xfree(self->FontName);
|
||||||
|
@ -979,7 +980,7 @@ void
|
||||||
PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso)
|
PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
static char buf[256];
|
char buf[256];
|
||||||
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
|
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
|
||||||
mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
|
mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
|
||||||
mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
|
mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
|
||||||
|
@ -1171,6 +1172,30 @@ PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, int bclr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, int bclr)
|
||||||
|
{
|
||||||
|
int xo = self->XOff;
|
||||||
|
int yo = self->YOff;
|
||||||
|
|
||||||
|
if( self->InFrame || self->InTile ) xo = yo = 0;
|
||||||
|
x += xo; y += yo;
|
||||||
|
S_OutStr16(self, text, textl);
|
||||||
|
S_OutNum(self, (float)x);
|
||||||
|
S_OutNum(self, (float)y);
|
||||||
|
if( bclr<0 ) S_OutTok(self, "T", 1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int ir = bclr>>16;
|
||||||
|
int ig = (bclr>>8)&0xFF;
|
||||||
|
int ib = bclr&0xFF;
|
||||||
|
S_OutNum(self, (float)ir/255.);
|
||||||
|
S_OutNum(self, (float)ig/255.);
|
||||||
|
S_OutNum(self, (float)ib/255.);
|
||||||
|
S_OutTok(self, "Tb", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef BM_CACHE
|
#ifdef BM_CACHE
|
||||||
void /* new */
|
void /* new */
|
||||||
PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
|
PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
|
||||||
|
@ -1181,7 +1206,7 @@ PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
|
||||||
|
|
||||||
if( self->InFrame || self->InTile ) xo = yo = 0;
|
if( self->InFrame || self->InTile ) xo = yo = 0;
|
||||||
x += xo; y += yo;
|
x += xo; y += yo;
|
||||||
sprintf(cacheID, "c%ldi", cache_id);
|
sprintf(cacheID, "c%di", cache_id);
|
||||||
|
|
||||||
S_OutNum(self, (float)x);
|
S_OutNum(self, (float)x);
|
||||||
S_OutNum(self, (float)y);
|
S_OutNum(self, (float)y);
|
||||||
|
@ -1214,7 +1239,7 @@ PsOut_BeginImageCache(PsOutPtr self, long cache_id)
|
||||||
{
|
{
|
||||||
char cacheID[10];
|
char cacheID[10];
|
||||||
|
|
||||||
sprintf(cacheID, "/c%ldi {", cache_id);
|
sprintf(cacheID, "/c%di {", cache_id);
|
||||||
|
|
||||||
S_OutTok(self, cacheID, 0);
|
S_OutTok(self, cacheID, 0);
|
||||||
} /* new */
|
} /* new */
|
||||||
|
@ -1488,13 +1513,11 @@ PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type,
|
||||||
}
|
}
|
||||||
self->Patterns[self->NPatterns].tag = tag;
|
self->Patterns[self->NPatterns].tag = tag;
|
||||||
self->Patterns[self->NPatterns].type = type;
|
self->Patterns[self->NPatterns].type = type;
|
||||||
sprintf(key, "/ %ld", (long)tag);
|
sprintf(key, "/ %d", (int)tag);
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case PsTile: key[1] = 't'; break;
|
case PsTile: key[1] = 't'; break;
|
||||||
case PsStip: key[1] = 's'; break;
|
case PsStip: key[1] = 's'; break;
|
||||||
case PsOpStip: key[1] = 'o'; break;
|
case PsOpStip: key[1] = 'o'; break; }
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
S_OutTok(self, key, 0);
|
S_OutTok(self, key, 0);
|
||||||
S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0);
|
S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0);
|
||||||
S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0);
|
S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0);
|
||||||
|
@ -1535,13 +1558,11 @@ PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type)
|
||||||
for( i=0 ; i<self->NPatterns ; i++ )
|
for( i=0 ; i<self->NPatterns ; i++ )
|
||||||
{ if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; }
|
{ if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; }
|
||||||
if( i>=self->NPatterns ) return;
|
if( i>=self->NPatterns ) return;
|
||||||
sprintf(key, " %ld", (long)tag);
|
sprintf(key, " %d", (int)tag);
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case PsTile: key[0] = 't'; break;
|
case PsTile: key[0] = 't'; break;
|
||||||
case PsStip: key[0] = 's'; break;
|
case PsStip: key[0] = 's'; break;
|
||||||
case PsOpStip: key[0] = 'o'; break;
|
case PsOpStip: key[0] = 'o'; break; }
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
S_OutTok(self, key, 0);
|
S_OutTok(self, key, 0);
|
||||||
S_OutTok(self, "spt", 1);
|
S_OutTok(self, "spt", 1);
|
||||||
self->CurColor = 0xFFFFFFFF;
|
self->CurColor = 0xFFFFFFFF;
|
||||||
|
@ -1556,71 +1577,119 @@ PsOut_RawData(PsOutPtr self, char *data, int len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
typedef enum PsDownfontFontType_
|
||||||
PsOut_DownloadType1(PsOutPtr self, char *name, char *fname)
|
{
|
||||||
|
PsDFT_Type1PFA=0,
|
||||||
|
PsDFT_Type1PFB,
|
||||||
|
PsDFT_TrueType /* not implemented yet */
|
||||||
|
} PsDownfontFontType;
|
||||||
|
|
||||||
|
/* Download a PS Type1 font */
|
||||||
|
int
|
||||||
|
PsOut_DownloadType1(PsOutPtr self, const char *auditmsg, const char *name, const char *fname)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int stt;
|
int stt;
|
||||||
static char buf[256];
|
char buf[256];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
PsDownfontFontType type;
|
||||||
|
|
||||||
for( i=0 ; i<self->NDownloads ; i++ )
|
fp = fopen(fname, "r");
|
||||||
{ if( strcmp(name, self->Downloads[i])==0 ) break; }
|
if( !fp )
|
||||||
if( i<self->NDownloads ) return;
|
return 0;
|
||||||
|
|
||||||
if( (self->NDownloads+1)>self->MxDownloads )
|
#ifdef DEBUG_gisburn
|
||||||
|
/* This should be log-able! */
|
||||||
|
fprintf(stderr, "PsOut_DownloadType1: %s: Downloading '%s' from '%s'\n", auditmsg, name, fname);
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
|
||||||
|
fread(buf, 32, 1, fp);
|
||||||
|
fseek(fp, (long)0, 0);
|
||||||
|
|
||||||
|
/* Is this a Adobe PostScript Type 1 binary font (PFB) ? */
|
||||||
|
if( (buf[0]&0xFF)==0x80 && (buf[1]&0xFF)==0x01 )
|
||||||
{
|
{
|
||||||
if( self->NDownloads )
|
type = PsDFT_Type1PFB;
|
||||||
|
}
|
||||||
|
/* Is this a Adobe PostScript ASCII font (PFA) ? */
|
||||||
|
else if (!strncmp(buf, "%!PS-AdobeFont", 14))
|
||||||
{
|
{
|
||||||
self->MxDownloads *= 2;
|
type = PsDFT_Type1PFA;
|
||||||
self->Downloads = (char **)xrealloc(self->Downloads,
|
|
||||||
self->MxDownloads*sizeof(char *));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self->MxDownloads = 32;
|
/* This should be log-able! */
|
||||||
self->Downloads = (char **)xalloc(self->MxDownloads*sizeof(char *));
|
fprintf(stderr, "PsOut_DownloadType1: Unknown font type for '%s'\n", fname);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
self->Downloads[self->NDownloads] = (char *)xalloc(strlen(name)+1);
|
|
||||||
strcpy(self->Downloads[self->NDownloads], name);
|
|
||||||
self->NDownloads += 1;
|
|
||||||
|
|
||||||
S_Flush(self);
|
S_Flush(self);
|
||||||
sprintf(buf, "%%%%BeginFont: %s", name);
|
sprintf(buf, "%%%%BeginFont: %s", name);
|
||||||
S_Comment(self, buf);
|
S_Comment(self, buf);
|
||||||
fp = fopen(fname, "r");
|
|
||||||
if( !fp ) return;
|
|
||||||
fread(buf, 1, 1, fp);
|
|
||||||
fseek(fp, (long)0, 0);
|
|
||||||
if( (buf[0]&0xFF)==0x80 )
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
|
|
||||||
for(;;)
|
if( type == PsDFT_Type1PFB )
|
||||||
{
|
{
|
||||||
stt = fread(buf, 1, 2, fp);
|
char *buf,
|
||||||
if( stt!=2 || (buf[0]&0xFF)!=0x80 ) break;
|
*pt;
|
||||||
if( (int)buf[1]<1 || (int)buf[1]>2 ) break;
|
int len,
|
||||||
stt = fread(buf, 1, 4, fp);
|
ch,
|
||||||
if( stt!=4 ) break;
|
stype;
|
||||||
len = ((buf[3]&0xFF)<<24)|((buf[2]&0xFF)<<16)|
|
|
||||||
((buf[1]&0xFF)<<8)|(buf[0]&0xFF);
|
ch = fgetc(fp);
|
||||||
for(; len ;)
|
/* Strip out the binary headers and de-binary it */
|
||||||
|
while( (ch&0xFF) == 0x80 )
|
||||||
{
|
{
|
||||||
i = len<256 ? len : 256;
|
stype = fgetc(fp);
|
||||||
stt = fread(buf, 1, i, fp);
|
if( stype==3 ) /* eof mark */
|
||||||
if( stt<=0 ) break;
|
break;
|
||||||
if (!ferror(self->Fp)) {
|
len = fgetc(fp);
|
||||||
(void) fwrite(buf, 1, stt, self->Fp);
|
len |= fgetc(fp)<<8;
|
||||||
}
|
len |= fgetc(fp)<<16;
|
||||||
if( stt<i ) break;
|
len |= fgetc(fp)<<24;
|
||||||
len -= i;
|
buf = (char *)xalloc(len+1);
|
||||||
}
|
if( stype==1 )
|
||||||
|
{
|
||||||
|
/* Process ASCII section */
|
||||||
|
len = fread(buf, 1, len, fp);
|
||||||
|
/* convert any lone CRs (ie Mac eol) to LFs */
|
||||||
|
for( pt = buf ; (pt = memchr(pt, '\r', len-(pt-buf))) != NULL ; pt++ )
|
||||||
|
{
|
||||||
|
if ( pt[1]!='\n' )
|
||||||
|
*pt = '\n';
|
||||||
}
|
}
|
||||||
|
fwrite(buf, 1, len, self->Fp);
|
||||||
}
|
}
|
||||||
|
else if( stype==2 )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Process binary section */
|
||||||
|
len = fread(buf, 1, len, fp);
|
||||||
|
for( i=0 ; i<len ; i++ )
|
||||||
|
{
|
||||||
|
ch = buf[i];
|
||||||
|
if( ((ch>>4)&0xf) <= 9 )
|
||||||
|
fputc('0'+((ch>>4)&0xf), self->Fp);
|
||||||
else
|
else
|
||||||
|
fputc('A'-10+((ch>>4)&0xf), self->Fp);
|
||||||
|
|
||||||
|
if( (ch&0xf) <= 9 )
|
||||||
|
fputc('0'+(ch&0xf), self->Fp);
|
||||||
|
else
|
||||||
|
fputc('A'-10+(ch&0xf), self->Fp);
|
||||||
|
|
||||||
|
if( (i&0x1f)==0x1f )
|
||||||
|
fputc('\n', self->Fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xfree(buf);
|
||||||
|
|
||||||
|
/* Next block... */
|
||||||
|
ch = fgetc(fp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Is this a Adobe PostScript ASCII font (PFA) ? */
|
||||||
|
else if (type == PsDFT_Type1PFA)
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
@ -1629,10 +1698,20 @@ PsOut_DownloadType1(PsOutPtr self, char *name, char *fname)
|
||||||
if (!ferror(self->Fp)) {
|
if (!ferror(self->Fp)) {
|
||||||
(void) fwrite(buf, 1, stt, self->Fp);
|
(void) fwrite(buf, 1, stt, self->Fp);
|
||||||
}
|
}
|
||||||
if( stt<256 ) break;
|
if( stt<256 )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
S_Flush(self);
|
S_Flush(self);
|
||||||
S_Comment(self, "%%EndFont");
|
S_Comment(self, "%%EndFont");
|
||||||
|
|
||||||
|
/* Success... */
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ in this Software without prior written authorization from The Open Group.
|
||||||
* or other dealings in this Software without prior written authorization
|
* or other dealings in this Software without prior written authorization
|
||||||
* from said copyright holders.
|
* from said copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.h,v 1.4 2001/12/14 19:59:18 dawes Exp $ */
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
**
|
**
|
||||||
|
@ -147,9 +146,79 @@ typedef struct PsClipRec_
|
||||||
|
|
||||||
typedef PsClipRec *PsClipPtr;
|
typedef PsClipRec *PsClipPtr;
|
||||||
|
|
||||||
|
typedef enum PsFTDownloadFontType_
|
||||||
|
{
|
||||||
|
PsFontBitmap=0,
|
||||||
|
PsFontType1,
|
||||||
|
PsFontType3
|
||||||
|
} PsFTDownloadFontType;
|
||||||
|
|
||||||
|
#ifdef USE_PSOUT_PRIVATE
|
||||||
|
typedef void *voidPtr;
|
||||||
|
|
||||||
|
typedef struct PsPatRec_
|
||||||
|
{
|
||||||
|
PsFillEnum type;
|
||||||
|
voidPtr tag;
|
||||||
|
} PsPatRec;
|
||||||
|
|
||||||
|
typedef PsPatRec *PsPatPtr;
|
||||||
|
|
||||||
|
typedef struct PsOutRec_
|
||||||
|
{
|
||||||
|
FILE *Fp;
|
||||||
|
char Buf[16384];
|
||||||
|
int CurColor;
|
||||||
|
int LineWidth;
|
||||||
|
PsCapEnum LineCap;
|
||||||
|
PsJoinEnum LineJoin;
|
||||||
|
int NDashes;
|
||||||
|
int *Dashes;
|
||||||
|
int DashOffset;
|
||||||
|
int LineBClr;
|
||||||
|
PsRuleEnum FillRule;
|
||||||
|
char *FontName;
|
||||||
|
int FontSize;
|
||||||
|
float FontMtx[4];
|
||||||
|
int ImageFormat;
|
||||||
|
int RevImage;
|
||||||
|
int NPatterns;
|
||||||
|
int MxPatterns;
|
||||||
|
PsPatPtr Patterns;
|
||||||
|
int ClipType;
|
||||||
|
PsClipRec Clip;
|
||||||
|
int InFrame;
|
||||||
|
int XOff;
|
||||||
|
int YOff;
|
||||||
|
|
||||||
|
PsFillEnum InTile;
|
||||||
|
int ImgSkip;
|
||||||
|
int ImgBClr;
|
||||||
|
int ImgFClr;
|
||||||
|
int ImgX;
|
||||||
|
int ImgY;
|
||||||
|
int ImgW;
|
||||||
|
int ImgH;
|
||||||
|
int SclW;
|
||||||
|
int SclH;
|
||||||
|
|
||||||
|
Bool isRaw;
|
||||||
|
|
||||||
|
int pagenum;
|
||||||
|
|
||||||
|
int start_image;
|
||||||
|
} PsOutRec;
|
||||||
|
|
||||||
typedef struct PsOutRec_ *PsOutPtr;
|
typedef struct PsOutRec_ *PsOutPtr;
|
||||||
|
|
||||||
extern PsOutPtr PsOut_BeginFile(FILE *fp, int orient, int count, int plex,
|
extern void S_Flush(PsOutPtr self);
|
||||||
|
extern void S_OutNum(PsOutPtr self, float num);
|
||||||
|
extern void S_OutTok(PsOutPtr self, char *tok, int cr);
|
||||||
|
#else
|
||||||
|
typedef struct PsOutRec_ *PsOutPtr;
|
||||||
|
#endif /* USE_PSOUT_PRIVATE */
|
||||||
|
|
||||||
|
extern PsOutPtr PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex,
|
||||||
int res, int wd, int ht, Bool raw);
|
int res, int wd, int ht, Bool raw);
|
||||||
extern void PsOut_EndFile(PsOutPtr self, int closeFile);
|
extern void PsOut_EndFile(PsOutPtr self, int closeFile);
|
||||||
extern void PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex,
|
extern void PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex,
|
||||||
|
@ -182,6 +251,7 @@ extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
|
||||||
|
|
||||||
extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
|
extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
|
||||||
int bclr);
|
int bclr);
|
||||||
|
extern void PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, int bclr);
|
||||||
|
|
||||||
extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
|
extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
|
||||||
int w, int h, int sw, int sh, int format);
|
int w, int h, int sw, int sh, int format);
|
||||||
|
@ -200,16 +270,17 @@ extern void PsOut_EndPattern(PsOutPtr self);
|
||||||
extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
|
extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
|
||||||
|
|
||||||
extern void PsOut_RawData(PsOutPtr self, char *data, int len);
|
extern void PsOut_RawData(PsOutPtr self, char *data, int len);
|
||||||
extern void PsOut_DownloadType1(PsOutPtr self, char *name, char *fname);
|
|
||||||
|
|
||||||
#ifdef BM_CACHE
|
|
||||||
extern void PsOut_BeginImageCache(PsOutPtr self, long cache_id);
|
|
||||||
extern void PsOut_EndImageCache(PsOutPtr self);
|
|
||||||
extern void PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id,
|
|
||||||
int bclr, int fclr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern FILE *PsOut_ChangeFile(PsOutPtr self, FILE *fp);
|
|
||||||
|
|
||||||
|
|
||||||
|
extern int PsOut_DownloadType1(PsOutPtr self, const char *auditmsg, const char *name, const char *fname);
|
||||||
|
|
||||||
|
extern int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset);
|
||||||
|
extern int PsOut_DownloadFreeType3(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset);
|
||||||
|
|
||||||
|
extern int PsOut_DownloadFreeType(PsOutPtr self, PsFTDownloadFontType downloadfonttype, const char *psfontname, FontPtr pFont, long block_offset);
|
||||||
|
extern void PsOut_Get_FreeType_Glyph_Name( char *destbuf, FontPtr pFont, unsigned long x11fontindex);
|
||||||
|
extern void PsOut_FreeType_Text(FontPtr pFont, PsOutPtr self, int x, int y, char *text, int textl);
|
||||||
|
extern void PsOut_FreeType_Text16(FontPtr pFont, PsOutPtr self, int x, int y, unsigned short *text, int textl);
|
||||||
|
|
||||||
|
extern void PsOut_FreeType_TextAttrs16(PsOutPtr self, char *fnam, int siz, int iso);
|
||||||
|
extern void PsOut_FreeType_TextAttrsMtx16(PsOutPtr self, char *fnam, float *mtx, int iso);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,330 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "os.h"
|
||||||
|
#define USE_PSOUT_PRIVATE 1
|
||||||
|
#include "psout.h"
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
#include FT_TYPE1_TABLES_H
|
||||||
|
|
||||||
|
#include "Xproto.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "fontstruct.h"
|
||||||
|
#include "fntfilst.h"
|
||||||
|
#include "fontutil.h"
|
||||||
|
#include "fontenc.h"
|
||||||
|
#include "ft.h"
|
||||||
|
#include "ftfuncs.h"
|
||||||
|
#include "servermd.h" /* needed for endian test (IMAGE_BYTE_ORDER) */
|
||||||
|
|
||||||
|
#define USE_FT_PS_NAMES 1
|
||||||
|
|
||||||
|
#ifdef USE_FT_PS_NAMES
|
||||||
|
void PsOut_Get_FreeType_Glyph_Name( char *destbuf, FontPtr pFont, unsigned long x11fontindex)
|
||||||
|
{
|
||||||
|
FTFontPtr tf = (FTFontPtr)pFont->fontPrivate;
|
||||||
|
FT_Face ttface = tf->instance->face->face;
|
||||||
|
FT_Error error;
|
||||||
|
char buf[256];
|
||||||
|
unsigned long ftindex;
|
||||||
|
|
||||||
|
/* Remap X11 font index to FreeType font index */
|
||||||
|
ftindex = FTRemap(ttface, &tf->mapping, x11fontindex);
|
||||||
|
|
||||||
|
if( FT_Has_PS_Glyph_Names(ttface) )
|
||||||
|
{
|
||||||
|
error = FT_Get_Glyph_Name(ttface, ftindex, buf, 64);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( error )
|
||||||
|
{
|
||||||
|
/* Check for unicode mapping
|
||||||
|
* See Adobe document "Unicode and Glyph Names"
|
||||||
|
* (http://partners.adobe.com/asn/tech/type/unicodegn.jsp)
|
||||||
|
*/
|
||||||
|
if( (tf->mapping.mapping->type == FONT_ENCODING_UNICODE) &&
|
||||||
|
(ftindex < 0xFFFE) )
|
||||||
|
{
|
||||||
|
sprintf(buf, "uni%04lx", ftindex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(buf, "ch%02lx", ftindex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(destbuf, buf);
|
||||||
|
}
|
||||||
|
#endif /* USE_FT_PS_NAMES */
|
||||||
|
|
||||||
|
int PsOut_DownloadFreeType(PsOutPtr self, PsFTDownloadFontType downloadfonttype, const char *psfontname, FontPtr pFont, long block_offset)
|
||||||
|
{
|
||||||
|
switch(downloadfonttype)
|
||||||
|
{
|
||||||
|
case PsFontType3:
|
||||||
|
return PsOut_DownloadFreeType3(self, psfontname, pFont, block_offset);
|
||||||
|
case PsFontType1:
|
||||||
|
return PsOut_DownloadFreeType1(self, psfontname, pFont, block_offset);
|
||||||
|
default:
|
||||||
|
FatalError("PS DDX: PsOut_DownloadFreeType(downloadfonttype='%d' not implemented\n",
|
||||||
|
(int)downloadfonttype);
|
||||||
|
return 0; /* NO-OP, FatalError() will call |exit()| */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cloned from |PsOut_TextAttrs16| */
|
||||||
|
void
|
||||||
|
PsOut_FreeType_TextAttrs16(PsOutPtr self, char *fnam, int siz, int iso)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
|
||||||
|
siz==self->FontSize ) return;
|
||||||
|
if( self->FontName ) xfree(self->FontName);
|
||||||
|
self->FontName = (char *)xalloc(strlen(fnam)+1);
|
||||||
|
strcpy(self->FontName, fnam);
|
||||||
|
self->FontSize = siz;
|
||||||
|
for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cloned from |PsOut_TextAttrsMtx16| */
|
||||||
|
void
|
||||||
|
PsOut_FreeType_TextAttrsMtx16(PsOutPtr self, char *fnam, float *mtx, int iso)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
|
||||||
|
mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
|
||||||
|
mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
|
||||||
|
if( self->FontName ) xfree(self->FontName);
|
||||||
|
self->FontName = (char *)xalloc(strlen(fnam)+1);
|
||||||
|
strcpy(self->FontName, fnam);
|
||||||
|
for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = mtx[i];
|
||||||
|
self->FontSize = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int FT_Get_CharcellMetricsCharacterHeight(FontPtr pFont)
|
||||||
|
{
|
||||||
|
FTFontPtr ftfont = (FTFontPtr)pFont->fontPrivate;
|
||||||
|
|
||||||
|
return ftfont->instance->charcellMetrics->ascent +
|
||||||
|
ftfont->instance->charcellMetrics->descent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int FT_Get_CharcellMetricsCharacterWidth(FontPtr pFont)
|
||||||
|
{
|
||||||
|
FTFontPtr ftfont = (FTFontPtr)pFont->fontPrivate;
|
||||||
|
|
||||||
|
if( ftfont->instance->spacing != FT_PROPORTIONAL )
|
||||||
|
{
|
||||||
|
int width = ftfont->instance->charcellMetrics->characterWidth;
|
||||||
|
|
||||||
|
/* If the font uses a matrix make sure we transform the |characterWidth|
|
||||||
|
* back to it's original value since we download the untransformed font
|
||||||
|
* and use a PostScript transformation matrix to transform the font when
|
||||||
|
* rendering the text
|
||||||
|
*/
|
||||||
|
if( ftfont->instance->transformation.nonIdentity )
|
||||||
|
{
|
||||||
|
FT_Vector v;
|
||||||
|
|
||||||
|
FT_Matrix m = ftfont->instance->transformation.matrix;
|
||||||
|
(void)FT_Matrix_Invert(&m); /* FixMe: We should check the return code */
|
||||||
|
v.x = width;
|
||||||
|
v.y = FT_Get_CharcellMetricsCharacterHeight(pFont);
|
||||||
|
FT_Vector_Transform(&v, &m);
|
||||||
|
width = v.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PsOut_FreeType_Text(FontPtr pFont, PsOutPtr self, int x, int y, char *text, int textl)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int xo = self->XOff,
|
||||||
|
yo = self->YOff;
|
||||||
|
char buf[256];
|
||||||
|
int cwidth = FT_Get_CharcellMetricsCharacterWidth(pFont);
|
||||||
|
|
||||||
|
if( self->InFrame || self->InTile ) xo = yo = 0;
|
||||||
|
x += xo; y += yo;
|
||||||
|
|
||||||
|
S_OutNum(self, (float)x);
|
||||||
|
S_OutNum(self, (float)y);
|
||||||
|
S_OutTok(self, "moveto", 1);
|
||||||
|
|
||||||
|
S_OutTok(self, "[ ", 0);
|
||||||
|
|
||||||
|
for( i = 0 ; i < textl ; i++ )
|
||||||
|
{
|
||||||
|
#ifdef USE_FT_PS_NAMES
|
||||||
|
char namebuf[256];
|
||||||
|
unsigned int ch = text[i]&0xFF;
|
||||||
|
unsigned long block_offset = 0;
|
||||||
|
PsOut_Get_FreeType_Glyph_Name(namebuf, pFont, ch+block_offset);
|
||||||
|
|
||||||
|
sprintf(buf, "/%s ", namebuf);
|
||||||
|
#else
|
||||||
|
sprintf(buf, "/ch%02x ", text[i]&0xFF);
|
||||||
|
#endif /* USE_FT_PS_NAMES */
|
||||||
|
S_OutTok(self, buf, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check whether we have any special spacing requirements (e.g. non-proportional fonts) ... */
|
||||||
|
if( cwidth != 0 )
|
||||||
|
{
|
||||||
|
/* If the we use a matrix to render the font (instead of using |self->FontSize|)
|
||||||
|
* we must apply the matrix to the "rmoveto" which is used to force the exact
|
||||||
|
* character width. The "trmoveto" macro will do that for us...
|
||||||
|
*/
|
||||||
|
if( self->FontSize == -1 )
|
||||||
|
{
|
||||||
|
sprintf(buf, "]{gs glyphshow gr %d 0 trmoveto}fa", cwidth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(buf, "]{gs glyphshow gr %d 0 rm}fa", cwidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(buf, "]{glyphshow}fa");
|
||||||
|
}
|
||||||
|
S_OutTok(self, buf, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* XXX: |PsOut_FreeType_Text16| should be rewritten - currently it uses lame,
|
||||||
|
* slow hacks and makes some risky assumtions about how |PsOut_Text16|
|
||||||
|
* allocates memory */
|
||||||
|
void
|
||||||
|
PsOut_FreeType_Text16(FontPtr pFont, PsOutPtr self, int x, int y, unsigned short *text, int textl)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int xo = self->XOff,
|
||||||
|
yo = self->YOff;
|
||||||
|
unsigned short c,
|
||||||
|
c_hiByte,
|
||||||
|
c_lowByte,
|
||||||
|
fontPage;
|
||||||
|
long lastFontPage = -1;
|
||||||
|
char baseFontName[256];
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
if( self->InFrame || self->InTile ) xo = yo = 0;
|
||||||
|
x += xo; y += yo;
|
||||||
|
|
||||||
|
strcpy(baseFontName, self->FontName);
|
||||||
|
|
||||||
|
S_OutNum(self, (float)x);
|
||||||
|
S_OutNum(self, (float)y);
|
||||||
|
S_OutTok(self, "moveto", 1);
|
||||||
|
|
||||||
|
for( i = 0 ; i < textl ; i++ )
|
||||||
|
{
|
||||||
|
c = text[i];
|
||||||
|
#if IMAGE_BYTE_ORDER == LSBFirst
|
||||||
|
c_hiByte = c & 0x00FF;
|
||||||
|
c_lowByte = (c >> 8) & 0x00FF;
|
||||||
|
#elif IMAGE_BYTE_ORDER == MSBFirst
|
||||||
|
c_hiByte = (c >> 8) & 0x00FF;
|
||||||
|
c_lowByte = c & 0x00FF;
|
||||||
|
#else
|
||||||
|
#error Unsupported byte order
|
||||||
|
#endif
|
||||||
|
fontPage = c_hiByte;
|
||||||
|
|
||||||
|
if( fontPage != lastFontPage )
|
||||||
|
{
|
||||||
|
if( fontPage > 0 )
|
||||||
|
{
|
||||||
|
sprintf(buf, "%s_%x", baseFontName, fontPage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(buf, "%s", baseFontName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( self->FontSize == -1 )
|
||||||
|
{
|
||||||
|
PsOut_TextAttrsMtx(self, buf, self->FontMtx, FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PsOut_TextAttrs(self, buf, self->FontSize, FALSE);
|
||||||
|
}
|
||||||
|
lastFontPage = fontPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FT_PS_NAMES
|
||||||
|
{
|
||||||
|
char namebuf[256];
|
||||||
|
unsigned int ch = c_lowByte;
|
||||||
|
unsigned long block_offset = c_hiByte * 0x100 /* same as c_hiByte << 8 */;
|
||||||
|
int cwidth = FT_Get_CharcellMetricsCharacterWidth(pFont);
|
||||||
|
PsOut_Get_FreeType_Glyph_Name(namebuf, pFont, ch+block_offset);
|
||||||
|
|
||||||
|
/* Check whether we have any special spacing requirements (e.g. non-proportional fonts) ... */
|
||||||
|
if( cwidth != 0 )
|
||||||
|
{
|
||||||
|
/* If the we use a matrix to render the font (instead of using |self->FontSize|)
|
||||||
|
* we must apply the matrix to the "rmoveto" which is used to force the exact
|
||||||
|
* character width. The "trmoveto" macro will do that for us...
|
||||||
|
*/
|
||||||
|
if( self->FontSize == -1 )
|
||||||
|
{
|
||||||
|
sprintf(buf, "gs /%s glyphshow gr %d 0 trmoveto", namebuf, cwidth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(buf, "gs /%s glyphshow gr %d 0 rm", namebuf, cwidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(buf, "/%s glyphshow", namebuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
sprintf(buf, "/ch%02x glyphshow", c_lowByte);
|
||||||
|
#endif /* USE_FT_PS_NAMES */
|
||||||
|
S_OutTok(self, buf, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( self->FontName ) xfree(self->FontName);
|
||||||
|
self->FontName = (char *)xalloc(strlen(baseFontName)+1);
|
||||||
|
strcpy(self->FontName, baseFontName);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include "os.h"
|
||||||
|
#define USE_PSOUT_PRIVATE 1
|
||||||
|
#include "psout.h"
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
|
#include "Xproto.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "fontstruct.h"
|
||||||
|
#include "fntfilst.h"
|
||||||
|
#include "fontutil.h"
|
||||||
|
#include "fontenc.h"
|
||||||
|
#include "ft.h"
|
||||||
|
#include "ftfuncs.h"
|
||||||
|
|
||||||
|
int do_debug_ft2pt1 = FALSE;
|
||||||
|
int do_enable_ft2pt1_optimizer = FALSE;
|
||||||
|
|
||||||
|
/* Defined in ttf2pt1.c */
|
||||||
|
int ft2pt1_main(int argc, char **argv,
|
||||||
|
FTFontPtr tf, const char *download_psfontname, unsigned long download_font_block_offset);
|
||||||
|
|
||||||
|
/* Download FreeType outlines as PS Type1 font */
|
||||||
|
int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset)
|
||||||
|
{
|
||||||
|
FTFontPtr tf;
|
||||||
|
FT_Face face;
|
||||||
|
int ft2pt1_numargs = 0;
|
||||||
|
char *ft2pt1_args[40];
|
||||||
|
char *pstype1filename_prefix;
|
||||||
|
char pstype1filename[PATH_MAX+1];
|
||||||
|
int ft2pt1_main_retval;
|
||||||
|
pid_t childpid;
|
||||||
|
|
||||||
|
tf = (FTFontPtr)pFont->fontPrivate;
|
||||||
|
face = tf->instance->face->face;
|
||||||
|
|
||||||
|
/* Set debugging flags */
|
||||||
|
do_debug_ft2pt1 = (getenv("XPRT_PSDDX_DO_DEBUG_FT2PT1") != NULL);
|
||||||
|
do_enable_ft2pt1_optimizer = (getenv("XPRT_PSDDX_DO_ENABLE_FT2PT1_OPTIMIZER") != NULL);
|
||||||
|
|
||||||
|
if( do_debug_ft2pt1 )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "# Converting FT2 font to PS Type1 filename='%s', ttface=%lx\n", tf->instance->face->filename, (long)face);
|
||||||
|
}
|
||||||
|
|
||||||
|
pstype1filename_prefix = tempnam(NULL, "Xprt_");
|
||||||
|
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "ft2pt1"; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-Ob"; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-e"; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-a"; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-Ga"; ft2pt1_numargs++;
|
||||||
|
if( do_enable_ft2pt1_optimizer )
|
||||||
|
{
|
||||||
|
/* Scale fonts to a 1000x1000 matrix */
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-Ot"; ft2pt1_numargs++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Disable the ttf2pt1 optimisations */
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-Ou"; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-Oo"; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-Os"; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-Oh"; ft2pt1_numargs++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !do_debug_ft2pt1 )
|
||||||
|
{
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = "-W 0"; ft2pt1_numargs++;
|
||||||
|
}
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = tf->instance->face->filename; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = pstype1filename_prefix; ft2pt1_numargs++;
|
||||||
|
ft2pt1_args[ft2pt1_numargs] = NULL;
|
||||||
|
|
||||||
|
/* XXX: ttf2pt1 has lots of leaks and global vars which are not cleaned-up
|
||||||
|
* As long this problem exists we will simply fork() and call the converter
|
||||||
|
* from the child process (all resources are free'ed when the child process
|
||||||
|
* exists) as a workaround.
|
||||||
|
*/
|
||||||
|
#define FT2PT1_NEEDS_SEPERATE_PROCESS 1
|
||||||
|
|
||||||
|
#ifdef FT2PT1_NEEDS_SEPERATE_PROCESS
|
||||||
|
/* Flush internal buffer and then the stdio stream before fork()! */
|
||||||
|
S_Flush(self);
|
||||||
|
fflush(self->Fp);
|
||||||
|
|
||||||
|
childpid = fork();
|
||||||
|
switch(childpid)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
FatalError("PS DDX internal error: Cannot fork() converter child process, errno=%d\n", (int)errno);
|
||||||
|
break;
|
||||||
|
case 0: /* child */
|
||||||
|
fclose(self->Fp);
|
||||||
|
self->Fp = NULL;
|
||||||
|
|
||||||
|
ft2pt1_main_retval = ft2pt1_main(ft2pt1_numargs, ft2pt1_args, tf, psfontname, block_offset);
|
||||||
|
if( do_debug_ft2pt1 )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "## ft2pt1_main returned %d (child)\n", ft2pt1_main_retval);
|
||||||
|
}
|
||||||
|
exit(ft2pt1_main_retval);
|
||||||
|
break;
|
||||||
|
default: /* parent */
|
||||||
|
waitpid(childpid, &ft2pt1_main_retval, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( do_debug_ft2pt1 )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "## ft2pt1_main returned %d (parent)\n", ft2pt1_main_retval);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
S_Flush(self);
|
||||||
|
|
||||||
|
ft2pt1_main_retval = ft2pt1_main(ft2pt1_numargs, ft2pt1_args, tf, psfontname, block_offset);
|
||||||
|
if( do_debug_ft2pt1 )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "## ft2pt1_main returned %d (child)\n", ft2pt1_main_retval);
|
||||||
|
}
|
||||||
|
#endif /* FT2PT1_NEEDS_SEPERATE_PROCESS */
|
||||||
|
|
||||||
|
if( ft2pt1_main_retval != EXIT_SUCCESS )
|
||||||
|
{
|
||||||
|
FatalError("PS DDX internal error while converting FreeType font '%s' to PS Type1, error=%d\n",
|
||||||
|
tf->instance->face->filename, ft2pt1_main_retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(pstype1filename, "%s.pfa", pstype1filename_prefix);
|
||||||
|
if( do_debug_ft2pt1 )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "# Downloading converted FT2/PS Type1 filename='%s'\n", pstype1filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
PsOut_DownloadType1(self, "PsOut_DownloadFreeType1", psfontname, pstype1filename);
|
||||||
|
|
||||||
|
if( !do_debug_ft2pt1 )
|
||||||
|
{
|
||||||
|
unlink(pstype1filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pstype1filename_prefix);
|
||||||
|
|
||||||
|
S_Flush(self);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,463 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "os.h"
|
||||||
|
#define USE_PSOUT_PRIVATE 1
|
||||||
|
#include "psout.h"
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
#include FT_TRUETYPE_TABLES_H
|
||||||
|
#include FT_BBOX_H
|
||||||
|
#include FT_GLYPH_H
|
||||||
|
|
||||||
|
#include FT_CONFIG_CONFIG_H
|
||||||
|
#include FT_CONFIG_OPTIONS_H
|
||||||
|
#include FT_ERRORS_H
|
||||||
|
#include FT_SYSTEM_H
|
||||||
|
#include FT_IMAGE_H
|
||||||
|
#include FT_TYPES_H
|
||||||
|
#include FT_OUTLINE_H
|
||||||
|
#include FT_MODULE_H
|
||||||
|
#include FT_RENDER_H
|
||||||
|
#include FT_TYPE1_TABLES_H
|
||||||
|
#include FT_TRUETYPE_IDS_H
|
||||||
|
#include FT_TRUETYPE_TAGS_H
|
||||||
|
#include FT_CACHE_H
|
||||||
|
#include FT_CACHE_IMAGE_H
|
||||||
|
#include FT_CACHE_SMALL_BITMAPS_H
|
||||||
|
#include FT_MULTIPLE_MASTERS_H
|
||||||
|
#include FT_SFNT_NAMES_H
|
||||||
|
|
||||||
|
#define USE_FT_INTERNALS 1
|
||||||
|
#ifdef USE_FT_INTERNALS
|
||||||
|
#include FT_INTERNAL_TYPE1_TYPES_H
|
||||||
|
#include "t42types.h"
|
||||||
|
#include FT_INTERNAL_OBJECTS_H
|
||||||
|
#endif /* USE_FT_INTERNALS */
|
||||||
|
|
||||||
|
#include "Xproto.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "fontstruct.h"
|
||||||
|
#include "fntfilst.h"
|
||||||
|
#include "fontutil.h"
|
||||||
|
#include "fontenc.h"
|
||||||
|
#include "ft.h"
|
||||||
|
#include "ftfuncs.h"
|
||||||
|
|
||||||
|
struct ft2info
|
||||||
|
{
|
||||||
|
FontPtr pFont;
|
||||||
|
FTFontPtr tf;
|
||||||
|
FT_Face ttface;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char *full_name;
|
||||||
|
char *copyright;
|
||||||
|
char *family;
|
||||||
|
char *subfamily;
|
||||||
|
char *version;
|
||||||
|
} nameid;
|
||||||
|
TT_Postscript *ttpostscript;
|
||||||
|
TT_Header *ttheader;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Local prototypes */
|
||||||
|
static FT_Error PSType3_createOutlineGlyphs(FILE *out, struct ft2info *ti, unsigned long unicode, const char *psglyphname);
|
||||||
|
static int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2info *ti, long block_offset);
|
||||||
|
|
||||||
|
extern FT_Library ftypeLibrary; /* defined in xc/lib/font/FreeType/ftfuncs.c */
|
||||||
|
|
||||||
|
#define USE_FT_PS_NAMES 1
|
||||||
|
|
||||||
|
static
|
||||||
|
FT_Error PSType3_createOutlineGlyphs( FILE *out, struct ft2info *ti, unsigned long x11fontindex, const char *psglyphname )
|
||||||
|
{
|
||||||
|
unsigned long ftindex;
|
||||||
|
FT_BBox bbox;
|
||||||
|
FT_Error error;
|
||||||
|
FT_Outline outline;
|
||||||
|
|
||||||
|
/* Remap X11 font index to FreeType font index */
|
||||||
|
ftindex = FTRemap(ti->ttface, &ti->tf->mapping, x11fontindex);
|
||||||
|
|
||||||
|
error = FT_Load_Glyph(ti->ttface, ftindex, (FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING));
|
||||||
|
if( error )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "PSType3_createOutlineGlyphs: FT_Load_Glyph() failure, error=%d\n", (int)error);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
outline = ti->ttface->glyph->outline;
|
||||||
|
|
||||||
|
FT_Outline_Get_CBox(&outline, &bbox);
|
||||||
|
|
||||||
|
fprintf(out, "/%s {\n", psglyphname);
|
||||||
|
fprintf(out, "%ld 0 %ld %ld %ld %ld setcachedevice\n",
|
||||||
|
(signed long)ti->ttface->glyph->metrics.horiAdvance,
|
||||||
|
(long)bbox.xMin,
|
||||||
|
(long)bbox.yMin,
|
||||||
|
(long)bbox.xMax,
|
||||||
|
(long)bbox.yMax);
|
||||||
|
|
||||||
|
if( outline.n_contours > 0 )
|
||||||
|
{
|
||||||
|
long i,
|
||||||
|
j,
|
||||||
|
k, k1,
|
||||||
|
cs, ce,
|
||||||
|
nguide,
|
||||||
|
contour_start,
|
||||||
|
contour_end,
|
||||||
|
last_point;
|
||||||
|
Bool first;
|
||||||
|
FT_Vector *vec;
|
||||||
|
|
||||||
|
contour_start = ce = 0;
|
||||||
|
|
||||||
|
vec = outline.points;
|
||||||
|
last_point = outline.n_points;
|
||||||
|
|
||||||
|
i = j = k = 0;
|
||||||
|
first = TRUE;
|
||||||
|
|
||||||
|
while( i <= outline.contours[outline.n_contours - 1] )
|
||||||
|
{
|
||||||
|
contour_end = outline.contours[j];
|
||||||
|
|
||||||
|
if( first )
|
||||||
|
{
|
||||||
|
fprintf(out, "%ld %ld moveto\n", vec[i].x, vec[i].y);
|
||||||
|
contour_start = i;
|
||||||
|
first = FALSE;
|
||||||
|
}
|
||||||
|
else if( outline.tags[i] & FT_CURVE_TAG_ON )
|
||||||
|
{
|
||||||
|
fprintf(out, "%ld %ld lineto\n", vec[i].x, vec[i].y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Bool finished = FALSE;
|
||||||
|
|
||||||
|
cs = i-1;
|
||||||
|
nguide = 0;
|
||||||
|
while( !finished )
|
||||||
|
{
|
||||||
|
if( i == contour_end+1 )
|
||||||
|
{
|
||||||
|
ce = contour_start;
|
||||||
|
finished = TRUE;
|
||||||
|
}
|
||||||
|
else if( outline.tags[i] & FT_CURVE_TAG_ON )
|
||||||
|
{
|
||||||
|
ce = i;
|
||||||
|
finished = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
nguide++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( nguide )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
fprintf(out, "%ld %ld lineto\n", vec[ce].x, vec[ce].y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(vec[cs].x+2*vec[cs+1].x)/3,
|
||||||
|
(vec[cs].y+2*vec[cs+1].y)/3,
|
||||||
|
(2*vec[cs+1].x+vec[ce].x)/3,
|
||||||
|
(2*vec[cs+1].y+vec[ce].y)/3,
|
||||||
|
vec[ce].x, vec[ce].y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(-vec[cs].x+4*vec[cs+1].x)/3,
|
||||||
|
(-vec[cs].y+4*vec[cs+1].y)/3,
|
||||||
|
(4*vec[cs+2].x-vec[ce].x)/3,
|
||||||
|
(4*vec[cs+2].y-vec[ce].y)/3,
|
||||||
|
vec[ce].x, vec[ce].y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(vec[cs].x+2*vec[cs+1].x)/3,
|
||||||
|
(vec[cs].y+2*vec[cs+1].y)/3,
|
||||||
|
(5*vec[cs+1].x+vec[cs+2].x)/6,
|
||||||
|
(5*vec[cs+1].y+vec[cs+2].y)/6,
|
||||||
|
(vec[cs+1].x+vec[cs+2].x)/2,
|
||||||
|
(vec[cs+1].y+vec[cs+2].y)/2);
|
||||||
|
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(vec[cs+1].x+5*vec[cs+2].x)/6,
|
||||||
|
(vec[cs+1].y+5*vec[cs+2].y)/6,
|
||||||
|
(5*vec[cs+2].x+vec[cs+3].x)/6,
|
||||||
|
(5*vec[cs+2].y+vec[cs+3].y)/6,
|
||||||
|
(vec[cs+3].x+vec[cs+2].x)/2,
|
||||||
|
(vec[cs+3].y+vec[cs+2].y)/2);
|
||||||
|
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(vec[cs+2].x+5*vec[cs+3].x)/6,
|
||||||
|
(vec[cs+2].y+5*vec[cs+3].y)/6,
|
||||||
|
(2*vec[cs+3].x+vec[ce].x)/3,
|
||||||
|
(2*vec[cs+3].y+vec[ce].y)/3,
|
||||||
|
vec[ce].x, vec[ce].y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: /* anything |nguide > 3| */
|
||||||
|
k1 = cs + nguide;
|
||||||
|
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(vec[cs].x+2*vec[cs+1].x)/3,
|
||||||
|
(vec[cs].y+2*vec[cs+1].y)/3,
|
||||||
|
(5*vec[cs+1].x+vec[cs+2].x)/6,
|
||||||
|
(5*vec[cs+1].y+vec[cs+2].y)/6,
|
||||||
|
(vec[cs+1].x+vec[cs+2].x)/2,
|
||||||
|
(vec[cs+1].y+vec[cs+2].y)/2);
|
||||||
|
|
||||||
|
for( k = cs+2 ; k <= k1-1 ; k++ )
|
||||||
|
{
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(vec[k-1].x+5*vec[k].x)/6,
|
||||||
|
(vec[k-1].y+5*vec[k].y)/6,
|
||||||
|
(5*vec[k].x+vec[k+1].x)/6,
|
||||||
|
(5*vec[k].y+vec[k+1].y)/6,
|
||||||
|
(vec[k].x+vec[k+1].x)/2,
|
||||||
|
(vec[k].y+vec[k+1].y)/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n",
|
||||||
|
(vec[k1-1].x+5*vec[k1].x)/6,
|
||||||
|
(vec[k1-1].y+5*vec[k1].y)/6,
|
||||||
|
(2*vec[k1].x+vec[ce].x)/3,
|
||||||
|
(2*vec[k1].y+vec[ce].y)/3,
|
||||||
|
vec[ce].x, vec[ce].y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i >= contour_end )
|
||||||
|
{
|
||||||
|
fprintf(out, "closepath\n");
|
||||||
|
first = TRUE;
|
||||||
|
i = contour_end + 1;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(out, "fill } bind def\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_FT_INTERNALS
|
||||||
|
static FT_BBox *
|
||||||
|
FT_Get_PS_Font_BBox( FT_Face face )
|
||||||
|
{
|
||||||
|
const char *driver_name;
|
||||||
|
FT_BBox *font_bbox = NULL;
|
||||||
|
|
||||||
|
if ( face && face->driver && face->driver->root.clazz )
|
||||||
|
{
|
||||||
|
driver_name = face->driver->root.clazz->module_name;
|
||||||
|
if ( ft_strcmp( driver_name, "type1" ) == 0 )
|
||||||
|
font_bbox = &(((T1_Face)face)->type1.font_bbox);
|
||||||
|
else if ( ft_strcmp( driver_name, "t1cid" ) == 0 )
|
||||||
|
font_bbox = &(((CID_Face)face)->cid.font_bbox);
|
||||||
|
else if ( ft_strcmp( driver_name, "type42" ) == 0 )
|
||||||
|
font_bbox = &(((T42_Face)face)->type1.font_bbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
return font_bbox;
|
||||||
|
}
|
||||||
|
#endif /* USE_FT_INTERNALS */
|
||||||
|
|
||||||
|
static
|
||||||
|
int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2info *ti, long block_offset)
|
||||||
|
{
|
||||||
|
long i;
|
||||||
|
double scaler;
|
||||||
|
const int numchars = 256;
|
||||||
|
#ifdef USE_FT_PS_NAMES
|
||||||
|
int linewidth = 0;
|
||||||
|
#endif /* USE_FT_PS_NAMES */
|
||||||
|
|
||||||
|
fprintf(out, "%%%%BeginFont: %s\n", psfontname);
|
||||||
|
fprintf(out, "22 dict begin\n");
|
||||||
|
fprintf(out, "/FontType 3 def\n");
|
||||||
|
fprintf(out, "/StrokeWidth 0 def\n");
|
||||||
|
fprintf(out, "/PaintType 0 def\n");
|
||||||
|
fprintf(out, "/FontName (%s) def\n", psfontname);
|
||||||
|
fprintf(out, "/FontInfo 9 dict dup begin\n");
|
||||||
|
fprintf(out, " /FullName (%s) def\n", ti->nameid.full_name?ti->nameid.full_name:psfontname);
|
||||||
|
fprintf(out, " /Notice (%s) def\n", ti->nameid.copyright?ti->nameid.copyright:"nothing here");
|
||||||
|
fprintf(out, " /FamilyName (%s) def\n", ti->nameid.family?ti->nameid.family:psfontname);
|
||||||
|
fprintf(out, " /Weight (%s) def\n", ti->nameid.subfamily?ti->nameid.subfamily:"Regular");
|
||||||
|
fprintf(out, " /version (%s) def\n", ti->nameid.version?ti->nameid.version:"0.1");
|
||||||
|
|
||||||
|
if( ti->ttpostscript )
|
||||||
|
{
|
||||||
|
fprintf(out, " /italicAngle %.9g def\n", (double)ti->ttpostscript->italicAngle);
|
||||||
|
fprintf(out, " /underlineThickness %d def\n", (int)ti->ttpostscript->underlineThickness);
|
||||||
|
fprintf(out, " /underlinePosition %d def\n", (int)ti->ttpostscript->underlinePosition);
|
||||||
|
fprintf(out, " /isFixedPitch %s def\n", ((ti->ttpostscript->isFixedPitch)?("true"):("false")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(out, " /italicAngle %.9g def\n", 0.0);
|
||||||
|
fprintf(out, " /underlineThickness %d def\n", 100);
|
||||||
|
fprintf(out, " /underlinePosition %d def\n", 0);
|
||||||
|
fprintf(out, " /isFixedPitch false def\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(out, "end def\n");
|
||||||
|
|
||||||
|
scaler = (1000.0 / (double)ti->ttface->units_per_EM) / 1000.0;
|
||||||
|
fprintf(out, "/FontMatrix [%.9g 0 0 %.9g 0 0] def\n", scaler, scaler);
|
||||||
|
|
||||||
|
if( ti->ttheader )
|
||||||
|
{
|
||||||
|
fprintf(out, "/FontBBox [%d %d %d %d] def\n",
|
||||||
|
(int)ti->ttheader->xMin,
|
||||||
|
(int)ti->ttheader->yMin,
|
||||||
|
(int)ti->ttheader->xMax,
|
||||||
|
(int)ti->ttheader->yMax);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FT_BBox *font_bbox = FT_Get_PS_Font_BBox(ti->ttface);
|
||||||
|
fprintf(out, "/FontBBox [%d %d %d %d] def\n",
|
||||||
|
(int)font_bbox->xMin,
|
||||||
|
(int)font_bbox->yMin,
|
||||||
|
(int)font_bbox->xMax,
|
||||||
|
(int)font_bbox->yMax);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(out, "/Encoding [\n");
|
||||||
|
for( i = 0 ; i < 256 ; i++ )
|
||||||
|
{
|
||||||
|
#ifdef USE_FT_PS_NAMES
|
||||||
|
char namebuf[256];
|
||||||
|
PsOut_Get_FreeType_Glyph_Name(namebuf, ti->pFont, i+block_offset);
|
||||||
|
linewidth += strlen(namebuf) + 2;
|
||||||
|
fprintf(out, "/%s%s", namebuf, (linewidth > 70)?(linewidth = 0, "\n"):(" "));
|
||||||
|
#else
|
||||||
|
fprintf(out, "/ch%02x%s", i, (((i % 10) == 9)?("\n"):(" ")));
|
||||||
|
#endif /* USE_FT_PS_NAMES */
|
||||||
|
}
|
||||||
|
fprintf(out, "] def\n");
|
||||||
|
|
||||||
|
fprintf(out, "/CharProcs %d dict def CharProcs begin\n", (int)(numchars + 1));
|
||||||
|
fprintf(out, "/.notdef {\n"
|
||||||
|
"1000 0 0 0 0 0 setcachedevice\n"
|
||||||
|
"fill } bind def\n");
|
||||||
|
for( i = 0 ; i < numchars ; i++ )
|
||||||
|
{
|
||||||
|
char buf[32];
|
||||||
|
#ifdef USE_FT_PS_NAMES
|
||||||
|
char namebuf[256];
|
||||||
|
PsOut_Get_FreeType_Glyph_Name(namebuf, ti->pFont, i+block_offset);
|
||||||
|
sprintf(buf, "%s ", namebuf);
|
||||||
|
#else
|
||||||
|
sprintf(buf, "ch%02lx ", i);
|
||||||
|
#endif /* USE_FT_PS_NAMES */
|
||||||
|
PSType3_createOutlineGlyphs(out, ti, i+block_offset, buf);
|
||||||
|
}
|
||||||
|
fprintf(out, "end\n"
|
||||||
|
"/BuildGlyph {\n"
|
||||||
|
" exch /CharProcs get exch\n"
|
||||||
|
" 2 copy known not {pop /.notdef} if get exec } bind def\n"
|
||||||
|
"/BuildChar { 1 index /Encoding get exch get\n"
|
||||||
|
" 1 index /Encoding get exec } bind def\n");
|
||||||
|
fprintf(out, "currentdict end /%s exch definefont pop\n", psfontname);
|
||||||
|
fprintf(out, "%%EndFont\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
char *FT_Get_TT_NAME_ID(FT_Face ttface, int index)
|
||||||
|
{
|
||||||
|
FT_SfntName name;
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
if( index >= FT_Get_Sfnt_Name_Count(ttface) )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
FT_Get_Sfnt_Name(ttface, index, &name);
|
||||||
|
s = (char *)malloc(name.string_len+2);
|
||||||
|
if( !s )
|
||||||
|
return NULL;
|
||||||
|
memcpy(s, (char *)name.string, name.string_len);
|
||||||
|
s[name.string_len] = '\0';
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int PsOut_DownloadFreeType3(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset)
|
||||||
|
{
|
||||||
|
struct ft2info cft2info = { 0 };
|
||||||
|
struct ft2info *ti = &cft2info;
|
||||||
|
|
||||||
|
S_Flush(self);
|
||||||
|
|
||||||
|
ti->tf = (FTFontPtr)pFont->fontPrivate;
|
||||||
|
ti->ttface = ti->tf->instance->face->face;
|
||||||
|
ti->pFont = pFont;
|
||||||
|
#ifdef DEBUG_gisburn
|
||||||
|
fprintf(stderr, "# Downloading FT2 font filename='%s', ttface=%lx\n", ti->tf->instance->face->filename, (long)ti->ttface);
|
||||||
|
#endif /* DEBUG_gisburn */
|
||||||
|
|
||||||
|
ti->nameid.full_name = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FULL_NAME);
|
||||||
|
ti->nameid.copyright = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_COPYRIGHT);
|
||||||
|
ti->nameid.family = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FONT_FAMILY);
|
||||||
|
ti->nameid.subfamily = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FONT_SUBFAMILY);
|
||||||
|
ti->nameid.version = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_VERSION_STRING);
|
||||||
|
|
||||||
|
ti->ttheader = (TT_Header *)FT_Get_Sfnt_Table(ti->ttface, ft_sfnt_head);
|
||||||
|
ti->ttpostscript = (TT_Postscript *)FT_Get_Sfnt_Table(ti->ttface, ft_sfnt_post);
|
||||||
|
|
||||||
|
PSType3_generateOutlineFont(self->Fp, psfontname, ti, block_offset);
|
||||||
|
|
||||||
|
free(ti->nameid.full_name);
|
||||||
|
free(ti->nameid.copyright);
|
||||||
|
free(ti->nameid.family);
|
||||||
|
free(ti->nameid.subfamily);
|
||||||
|
free(ti->nameid.version);
|
||||||
|
|
||||||
|
S_Flush(self);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ not be used in advertising or otherwise to promote the sale, use or other
|
||||||
dealings in this Software without prior written authorization from said
|
dealings in this Software without prior written authorization from said
|
||||||
copyright holders.
|
copyright holders.
|
||||||
*/
|
*/
|
||||||
/* $XFree86: xc/programs/Xserver/Xprint/raster/Raster.h,v 1.3 2001/10/31 22:50:29 tsi Exp $ */
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
**
|
**
|
||||||
** *********************************************************
|
** *********************************************************
|
||||||
|
@ -53,6 +51,7 @@ copyright holders.
|
||||||
* Some sleazes to force the XrmDB stuff into the server
|
* Some sleazes to force the XrmDB stuff into the server
|
||||||
*/
|
*/
|
||||||
#ifndef HAVE_XPointer
|
#ifndef HAVE_XPointer
|
||||||
|
#define HAVE_XPointer 1
|
||||||
typedef char *XPointer;
|
typedef char *XPointer;
|
||||||
#endif
|
#endif
|
||||||
#define Status int
|
#define Status int
|
||||||
|
|
|
@ -0,0 +1,190 @@
|
||||||
|
|
||||||
|
/* $Xorg: spooler.c,v 1.1 2003/09/14 1:19:56 gisburn Exp $ */
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the names of the copyright holders shall
|
||||||
|
not be used in advertising or otherwise to promote the sale, use or other
|
||||||
|
dealings in this Software without prior written authorization from said
|
||||||
|
copyright holders.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <string.h>
|
||||||
|
#ifdef __hpux
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "spooler.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The string LIST_QUEUES_* is fed to a shell to generate an ordered
|
||||||
|
* list of available printers on the system. These string definitions
|
||||||
|
* are taken from the file PrintSubSys.C within the code for the
|
||||||
|
* dtprintinfo program.
|
||||||
|
*/
|
||||||
|
#define LIST_QUEUES_AIX4 \
|
||||||
|
"lsallq | grep -v '^bsh$' | sort | uniq"
|
||||||
|
|
||||||
|
#define LIST_QUEUES_HPUX \
|
||||||
|
"LANG=C lpstat -v | " \
|
||||||
|
"awk '" \
|
||||||
|
" $2 == \"for\" " \
|
||||||
|
" { " \
|
||||||
|
" x = match($3, /:/); " \
|
||||||
|
" print substr($3, 1, x-1)" \
|
||||||
|
" }' | sort | uniq"
|
||||||
|
|
||||||
|
#define LIST_QUEUES_OSF \
|
||||||
|
"LANG=C lpstat -v | " \
|
||||||
|
"nawk '" \
|
||||||
|
" $2 == \"for\" " \
|
||||||
|
" { print $4 }' " \
|
||||||
|
" | sort | uniq"
|
||||||
|
|
||||||
|
#define LIST_QUEUES_UXP \
|
||||||
|
"LANG=C lpstat -v |" \
|
||||||
|
"nawk '" \
|
||||||
|
" $4 == \"for\" " \
|
||||||
|
" { " \
|
||||||
|
" x = match($5, /:/); " \
|
||||||
|
" print substr($5, 1, x-1)" \
|
||||||
|
" }' | sort | uniq"
|
||||||
|
|
||||||
|
/* Support both normal and LPRng output of "lpc status" */
|
||||||
|
#define LIST_QUEUES_BSD \
|
||||||
|
"PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \
|
||||||
|
"export PATH\n" \
|
||||||
|
\
|
||||||
|
"which_tool()\n" \
|
||||||
|
"{\n" \
|
||||||
|
" echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \
|
||||||
|
"}\n" \
|
||||||
|
\
|
||||||
|
"(\n" \
|
||||||
|
"WHICH_LPC=\"`which_tool lpc`\"\n" \
|
||||||
|
\
|
||||||
|
"if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \
|
||||||
|
" NAWK=\"nawk\"\n" \
|
||||||
|
"else\n" \
|
||||||
|
" NAWK=\"awk\"\n" \
|
||||||
|
"fi\n" \
|
||||||
|
\
|
||||||
|
"[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc status | ${NAWK} '/^[^ ]*:$/ && !/@/ && !/ / { print $1 }' | sed -e /:/s///)\n" \
|
||||||
|
"[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc -a status | ${NAWK} '/^[^ ]*@[^ ]/ && !/:$/ { split( $1, name, \"@\" ); print name[1]; }')\n" \
|
||||||
|
") | egrep -v -i \" |^all$\" | sort | uniq"
|
||||||
|
|
||||||
|
#define LIST_QUEUES_SYSV \
|
||||||
|
"PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \
|
||||||
|
"export PATH\n" \
|
||||||
|
\
|
||||||
|
"which_tool()\n" \
|
||||||
|
"{\n" \
|
||||||
|
" echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \
|
||||||
|
"}\n" \
|
||||||
|
\
|
||||||
|
"(\n" \
|
||||||
|
"WHICH_LPSTAT=\"`which_tool lpstat`\"\n" \
|
||||||
|
\
|
||||||
|
"if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \
|
||||||
|
" NAWK=\"nawk\"\n" \
|
||||||
|
"else\n" \
|
||||||
|
" NAWK=\"awk\"\n" \
|
||||||
|
"fi\n" \
|
||||||
|
\
|
||||||
|
"[ \"${WHICH_LPSTAT}\" != \"\" ] && (LANG=C lpstat -v | ${NAWK} ' $2 == \"for\" { x = match($3, /:/); print substr($3, 1, x-1) }')\n" \
|
||||||
|
") | egrep -v -i \" |^all$\" | sort | uniq"
|
||||||
|
|
||||||
|
#define LIST_QUEUES_OTHER \
|
||||||
|
"LANG=C lpstat -v | " \
|
||||||
|
"nawk '" \
|
||||||
|
" $2 == \"for\" " \
|
||||||
|
" { " \
|
||||||
|
" x = match($3, /:/); " \
|
||||||
|
" print substr($3, 1, x-1)" \
|
||||||
|
" }' | sort | uniq"
|
||||||
|
|
||||||
|
#define DEFAULT_SPOOL_COMMAND_HPUX "/usr/bin/lp -d %printer-name% -o raw -n %copy-count% -t %job-name% %options%"
|
||||||
|
#define DEFAULT_SPOOL_COMMAND_BSD "/usr/bin/lpr -P %printer-name% -#%copy-count% -T %job-name% %options%"
|
||||||
|
#define DEFAULT_SPOOL_COMMAND_SYSV "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%"
|
||||||
|
#define DEFAULT_SPOOL_COMMAND_OTHER "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%"
|
||||||
|
|
||||||
|
|
||||||
|
/* List of spooler types and the commands used to enumerate
|
||||||
|
* print queues and submit print jobs */
|
||||||
|
XpSpoolerType xpstm[] =
|
||||||
|
{
|
||||||
|
/* OS-specific spoolers */
|
||||||
|
{ "aix", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER },
|
||||||
|
{ "aix4", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER },
|
||||||
|
{ "bsd", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD },
|
||||||
|
{ "osf", LIST_QUEUES_OSF, DEFAULT_SPOOL_COMMAND_OTHER },
|
||||||
|
{ "solaris", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
|
||||||
|
{ "sysv", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
|
||||||
|
{ "uxp", LIST_QUEUES_UXP, DEFAULT_SPOOL_COMMAND_OTHER },
|
||||||
|
/* crossplatform spoolers */
|
||||||
|
{ "cups", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV },
|
||||||
|
{ "lprng", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD },
|
||||||
|
/* misc */
|
||||||
|
{ "other", LIST_QUEUES_OTHER, DEFAULT_SPOOL_COMMAND_OTHER },
|
||||||
|
{ "none", NULL, NULL },
|
||||||
|
{ NULL, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Used by Init.c and attributes.c */
|
||||||
|
XpSpoolerTypePtr spooler_type = NULL;
|
||||||
|
|
||||||
|
XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name)
|
||||||
|
{
|
||||||
|
XpSpoolerTypePtr curr = xpstm;
|
||||||
|
|
||||||
|
while( curr->name != NULL )
|
||||||
|
{
|
||||||
|
if( !strcasecmp(name, curr->name) )
|
||||||
|
return curr;
|
||||||
|
|
||||||
|
curr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *spooler_namelist = NULL;
|
||||||
|
|
||||||
|
char *XpGetSpoolerTypeNameList(void)
|
||||||
|
{
|
||||||
|
if( spooler_namelist )
|
||||||
|
return spooler_namelist;
|
||||||
|
|
||||||
|
return XPDEFAULTSPOOLERNAMELIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XpSetSpoolerTypeNameList(char *namelist)
|
||||||
|
{
|
||||||
|
spooler_namelist = namelist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
#ifndef SPOOLER_H
|
||||||
|
#define SPOOLER_H 1
|
||||||
|
|
||||||
|
/* $Xorg: spooler.h,v 1.1 2003/09/14 1:19:56 gisburn Exp $ */
|
||||||
|
/*
|
||||||
|
Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the names of the copyright holders shall
|
||||||
|
not be used in advertising or otherwise to promote the sale, use or other
|
||||||
|
dealings in this Software without prior written authorization from said
|
||||||
|
copyright holders.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define platform-specific default spooler type
|
||||||
|
*/
|
||||||
|
#if defined(sun)
|
||||||
|
#define XPDEFAULTSPOOLERNAMELIST "solaris"
|
||||||
|
#elif defined(AIXV4)
|
||||||
|
#define XPDEFAULTSPOOLERNAMELIST "aix4"
|
||||||
|
#elif defined(hpux)
|
||||||
|
#define XPDEFAULTSPOOLERNAMELIST "hpux"
|
||||||
|
#elif defined(__osf__)
|
||||||
|
#define XPDEFAULTSPOOLERNAMELIST "osf"
|
||||||
|
#elif defined(__uxp__)
|
||||||
|
#define XPDEFAULTSPOOLERNAMELIST "uxp"
|
||||||
|
#elif defined(CSRG_BASED) || defined(linux)
|
||||||
|
/* ToDo: This should be "cups:bsd" in the future, but for now
|
||||||
|
* the search order first-bsd-then-cups is better for backwards
|
||||||
|
* compatibility.
|
||||||
|
*/
|
||||||
|
#define XPDEFAULTSPOOLERNAMELIST "bsd:cups"
|
||||||
|
#else
|
||||||
|
#define XPDEFAULTSPOOLERNAMELIST "other"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
const char *list_queues_command;
|
||||||
|
const char *spool_command;
|
||||||
|
} XpSpoolerType, *XpSpoolerTypePtr;
|
||||||
|
|
||||||
|
/* prototypes */
|
||||||
|
extern XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name);
|
||||||
|
extern void XpSetSpoolerTypeNameList(char *namelist);
|
||||||
|
extern char *XpGetSpoolerTypeNameList(void);
|
||||||
|
|
||||||
|
/* global vars */
|
||||||
|
extern XpSpoolerTypePtr spooler_type;
|
||||||
|
extern XpSpoolerType xpstm[];
|
||||||
|
|
||||||
|
#endif /* !SPOOLER_H */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XdotOrg$ */
|
/* $XdotOrg: xc/programs/Xserver/dix/dispatch.c,v 1.1.4.4.2.3.6.2 2004/04/20 03:27:08 gisburn Exp $ */
|
||||||
/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
|
/* $Xorg: dispatch.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ FlushClientCaches(id)
|
||||||
#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
|
#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
|
||||||
#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
|
#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
|
||||||
|
|
||||||
Bool SmartScheduleDisable;
|
Bool SmartScheduleDisable = FALSE;
|
||||||
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
|
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
|
||||||
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
|
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
|
||||||
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
|
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XdotOrg$ */
|
/* $XdotOrg: xc/programs/Xserver/dix/main.c,v 1.1.4.5.2.4.6.1 2004/04/20 03:27:08 gisburn Exp $ */
|
||||||
/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.43 2003/10/30 21:21:02 herrb Exp $ */
|
/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.43 2003/10/30 21:21:02 herrb Exp $ */
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
|
|
||||||
|
@ -251,6 +251,8 @@ main(int argc, char *argv[], char *envp[])
|
||||||
|
|
||||||
display = "0";
|
display = "0";
|
||||||
|
|
||||||
|
InitGlobals();
|
||||||
|
|
||||||
/* Quartz support on Mac OS X requires that the Cocoa event loop be in
|
/* Quartz support on Mac OS X requires that the Cocoa event loop be in
|
||||||
* the main thread. This allows the X server main to be called again
|
* the main thread. This allows the X server main to be called again
|
||||||
* from another thread. */
|
* from another thread. */
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||||
* use or other dealings in this Software without prior written authorization.
|
* use or other dealings in this Software without prior written authorization.
|
||||||
*/
|
*/
|
||||||
/* $XdotOrg$ */
|
/* $XdotOrg: xc/programs/Xserver/hw/darwin/darwin.c,v 1.1.4.2.4.1.6.3 2004/04/20 03:27:08 gisburn Exp $ */
|
||||||
/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.55 2003/11/15 00:07:09 torrey Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.55 2003/11/15 00:07:09 torrey Exp $ */
|
||||||
|
|
||||||
#include "X.h"
|
#include "X.h"
|
||||||
|
@ -448,9 +448,11 @@ static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
===========================================================================
|
||||||
|
|
||||||
Utility routines
|
Utility routines
|
||||||
|
|
||||||
|
===========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -538,9 +540,11 @@ static int DarwinParseModifierList(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
===========================================================================
|
||||||
|
|
||||||
Functions needed to link against device independent X
|
Functions needed to link against device independent X
|
||||||
|
|
||||||
|
===========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -693,6 +697,10 @@ void OsVendorInit(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
|
||||||
|
void ddxInitGlobals(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ddxProcessArgument --
|
* ddxProcessArgument --
|
||||||
|
|
|
@ -273,6 +273,11 @@ ddxUseMsg()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
|
||||||
|
void ddxInitGlobals(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ddxProcessArgument(int argc, char *argv[], int i)
|
ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1641,6 +1641,11 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
return xf86ProcessArgument(argc, argv, i);
|
return xf86ProcessArgument(argc, argv, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
|
||||||
|
void ddxInitGlobals(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ddxUseMsg --
|
* ddxUseMsg --
|
||||||
* Print out correct use of device dependent commandline options.
|
* Print out correct use of device dependent commandline options.
|
||||||
|
|
|
@ -47,6 +47,11 @@ int xnestNumScreens = 0;
|
||||||
Bool xnestDoDirectColormaps = False;
|
Bool xnestDoDirectColormaps = False;
|
||||||
Window xnestParentWindow = 0;
|
Window xnestParentWindow = 0;
|
||||||
|
|
||||||
|
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
|
||||||
|
void ddxInitGlobals(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ddxProcessArgument (int argc, char *argv[], int i)
|
ddxProcessArgument (int argc, char *argv[], int i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -394,6 +394,11 @@ ddxUseMsg (void)
|
||||||
/* Compare the current option with the string. */
|
/* Compare the current option with the string. */
|
||||||
#define IS_OPTION(name) (strcmp (argv[i], name) == 0)
|
#define IS_OPTION(name) (strcmp (argv[i], name) == 0)
|
||||||
|
|
||||||
|
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
|
||||||
|
void ddxInitGlobals(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ddxProcessArgument (int argc, char *argv[], int i)
|
ddxProcessArgument (int argc, char *argv[], int i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/include/os.h,v 3.53 2003/10/29 04:17:22 dawes Exp $ */
|
/* $XFree86: xc/programs/Xserver/include/os.h,v 3.54 2003/10/30 21:21:06 herrb Exp $ */
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
|
|
||||||
Copyright 1987, 1998 The Open Group
|
Copyright 1987, 1998 The Open Group
|
||||||
|
@ -231,6 +231,8 @@ extern SIGVAL GiveUp(int /*sig*/);
|
||||||
|
|
||||||
extern void UseMsg(void);
|
extern void UseMsg(void);
|
||||||
|
|
||||||
|
extern void InitGlobals(void);
|
||||||
|
|
||||||
extern void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
|
extern void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
|
||||||
|
|
||||||
extern int set_font_authorizations(
|
extern int set_font_authorizations(
|
||||||
|
@ -412,6 +414,8 @@ extern XID GenerateAuthorization(
|
||||||
extern void ExpandCommandLine(int * /*pargc*/, char *** /*pargv*/);
|
extern void ExpandCommandLine(int * /*pargc*/, char *** /*pargv*/);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void ddxInitGlobals(void);
|
||||||
|
|
||||||
extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
|
extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
|
||||||
|
|
||||||
extern void ddxUseMsg(void);
|
extern void ddxUseMsg(void);
|
||||||
|
|
13
os/utils.c
13
os/utils.c
|
@ -1,4 +1,4 @@
|
||||||
/* $XdotOrg$ */
|
/* $XdotOrg: xc/programs/Xserver/os/utils.c,v 1.1.4.6.2.4.6.3 2004/04/20 03:27:09 gisburn Exp $ */
|
||||||
/* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */
|
/* $Xorg: utils.c,v 1.5 2001/02/09 02:05:24 xorgcvs Exp $ */
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -575,6 +575,17 @@ VerifyDisplayName(const char *d)
|
||||||
return( 1 );
|
return( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is responsible for doing initalisation of any global
|
||||||
|
* variables at an very early point of server startup (even before
|
||||||
|
* |ProcessCommandLine()|.
|
||||||
|
*/
|
||||||
|
void InitGlobals(void)
|
||||||
|
{
|
||||||
|
ddxInitGlobals();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function parses the command line. Handles device-independent fields
|
* This function parses the command line. Handles device-independent fields
|
||||||
* and allows ddx to handle additional fields. It is not allowed to modify
|
* and allows ddx to handle additional fields. It is not allowed to modify
|
||||||
|
|
Loading…
Reference in New Issue