From fdc20559999878fb4bc79561dcb3759ce9a3f971 Mon Sep 17 00:00:00 2001 From: Sumpfork Date: Wed, 16 Mar 2016 15:05:43 -0700 Subject: [PATCH] Add horizontal/vertical gap option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Horizontal and vertical gap between dividers support - doesn’t properly work with crop marks yet. --- README.md | 2 +- domdiv/__init__.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 81dd13d..d4212ca 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ I believe I cannot distribute one font (Minion Pro) dominion\_tabs uses as they Sadly, these fonts use features of the otf format that are not support by the reportlab package. Thus, they need to first be converted to ttf (TrueType) format. I used the open source package fontforge to do the conversion. Included as 'convert.ff' is a script for fontforge to do the conversion, on Mac OS X with fontforge installed through macports you can just run './convert.ff MinionPro-Regular.otf' and './convert.ff MinionPro-Bold.otf'. With other fontforge installations, you'll need to change the first line of convert.ff to point to your fontforge executable. I have not done this step under Windows - I imagine it may be possible with a cygwin install of fontforge or some such method. ## Install/Running -Once the prerequisites exist, just run 'python dominiontabs.py ' to produce a pdf file of dominion tabs. You can use a '-h' flag to see various options, such as changing to vertical tabs. +Once the prerequisites exist, just run 'python dominion_dividers.py ' to produce a pdf file of dominion tabs. You can use a '-h' flag to see various options, such as changing to vertical tabs. Feel free to comment on boardgamegeek at or file issues on github (). diff --git a/domdiv/__init__.py b/domdiv/__init__.py index f6076ee..7c037b6 100644 --- a/domdiv/__init__.py +++ b/domdiv/__init__.py @@ -124,6 +124,10 @@ def parse_opts(argstring): help="use text/letters to represent a card's set instead of the set icon") parser.add_option("--no-page-footer", action="store_true", dest="no_page_footer", help="don't print the set name at the bottom of the page.") + parser.add_option("--horizontal_gap", type=float, default=0., + help="horizontal gap between dividers in centimeters") + parser.add_option("--vertical_gap", type=float, default=0., + help="vertical gap between dividers in centimeters") options, args = parser.parse_args(argstring) if not options.cost: @@ -361,8 +365,8 @@ def calculate_layout(options): else: labelWidth = options.tabwidth * cm labelHeight = .9 * cm - horizontalBorderSpace = 0 * cm - verticalBorderSpace = 0 * cm + horizontalBorderSpace = options.horizontal_gap * cm + verticalBorderSpace = options.vertical_gap * cm dividerHeight = dividerBaseHeight + labelHeight @@ -405,10 +409,10 @@ def calculate_layout(options): # dynamically max margins add_opt(options, 'horizontalMargin', (options.paperwidth - - options.numDividersHorizontal * options.dividerWidthReserved) / 2) + options.numDividersHorizontal * options.dividerWidthReserved + horizontalBorderSpace) / 2) add_opt(options, 'verticalMargin', (options.paperheight - - options.numDividersVertical * options.dividerHeightReserved) / 2) + options.numDividersVertical * options.dividerHeightReserved + verticalBorderSpace) / 2) else: add_opt(options, 'horizontalMargin', minmarginwidth) add_opt(options, 'verticalMargin', minmarginheight)