Skip to content

Commit

Permalink
Add encName to registerCidFonts.
Browse files Browse the repository at this point in the history
  • Loading branch information
strichter committed Dec 20, 2012
1 parent acc21c0 commit 3fed4f5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ CHANGES
* docPara
* docWhile

- Added ``encName`` attribute to ``registerCidFont`` directive.

- Don't show "doc" namespace in reference snippets.

- Create a list of RML2PDF and z3c.rml differences.
Expand Down
2 changes: 0 additions & 2 deletions RML-DIFFERENCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ naming.

- registerCidFont: +encName

- registerFontFamily (pdfmetrics.registerFontFamily())

- setFontSize (plain canvas op)

- log
Expand Down
13 changes: 11 additions & 2 deletions src/z3c/rml/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,21 @@ class IRegisterCidFont(interfaces.IRMLDirectiveSignature):
u'be previously registered.'),
required=True)

encName = attr.String(
title=u'Encoding Name',
description=(u'The name of the encoding to use for the font.'),
required=False)

class RegisterCidFont(directive.RMLDirective):
signature = IRegisterCidFont
attrMapping = {'faceName': 'face', 'encName': 'encoding'}

def process(self):
args = self.getAttributeValues(valuesOnly=True)
font = cidfonts.UnicodeCIDFont(*args)
args = dict(self.getAttributeValues(attrMapping=self.attrMapping))
if 'encoding' in args:
font = cidfonts.CIDFont(**args)
else:
font = cidfonts.UnicodeCIDFont(**args)
pdfmetrics.registerFont(font)


Expand Down
Binary file modified src/z3c/rml/tests/expected/tag-registerCidFont.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions src/z3c/rml/tests/input/tag-registerCidFont.rml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
xmlns:doc="http://namespaces.zope.org/rml/doc">
<docinit>
<registerCidFont faceName="HeiseiMin-W3" doc:example="" />
<registerCidFont faceName="HeiseiMin-W3" encName="90ms-RKSJ-H"
doc:example="" />
</docinit>
<template>
<pageTemplate id="main">
Expand All @@ -16,5 +18,8 @@
<para fontName="HeiseiMin-W3" fontSize="40">
日本語は難しいですね!
</para>
<para spaceBefore="3cm" fontName="HeiseiMin-W3" fontSize="40">
日本語は難しいですね!
</para>
</story>
</document>

0 comments on commit 3fed4f5

Please sign in to comment.