Skip to content

Commit

Permalink
Improve tab artwork & layout (#436)
Browse files Browse the repository at this point in the history
* Improve tab banner graphics
* Update treasure banner colors
* Brighten images for printing on cardstock
* Synchronize card_db_src/types_db.json
* Improve horizontal layout.
* Adjust margins for Events, Landmarks, and Projects.
  • Loading branch information
bszonye authored Jan 7, 2023
1 parent b4e8f2d commit 5785ef5
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 23 deletions.
28 changes: 14 additions & 14 deletions card_db_src/types_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@
],
"card_type_image": "treasure.png",
"defaultCardCount": 10,
"tabCostHeightOffset": 0,
"tabTextHeightOffset": 3
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
Expand Down Expand Up @@ -500,8 +500,8 @@
],
"card_type_image": "treasure.png",
"defaultCardCount": 16,
"tabCostHeightOffset": 0,
"tabTextHeightOffset": 3
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
Expand Down Expand Up @@ -874,8 +874,8 @@
],
"card_type_image": "treasure.png",
"defaultCardCount": 10,
"tabCostHeightOffset": 0,
"tabTextHeightOffset": 3
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
Expand All @@ -884,8 +884,8 @@
],
"card_type_image": "treasure.png",
"defaultCardCount": 10,
"tabCostHeightOffset": 0,
"tabTextHeightOffset": 3
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
Expand Down Expand Up @@ -916,8 +916,8 @@
],
"card_type_image": "treasure.png",
"defaultCardCount": 10,
"tabCostHeightOffset": 0,
"tabTextHeightOffset": 3
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
Expand All @@ -926,8 +926,8 @@
],
"card_type_image": "treasure.png",
"defaultCardCount": 6,
"tabCostHeightOffset": 0,
"tabTextHeightOffset": 3
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
Expand All @@ -946,8 +946,8 @@
],
"card_type_image": "treasure.png",
"defaultCardCount": 1,
"tabCostHeightOffset": 0,
"tabTextHeightOffset": 3
"tabCostHeightOffset": -1,
"tabTextHeightOffset": 0
},
{
"card_type": [
Expand Down
Binary file modified src/domdiv/card_db/types_db.json.gz
Binary file not shown.
3 changes: 3 additions & 0 deletions src/domdiv/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def isLandmark(self):
def isPrize(self):
return self.isType("Prize")

def isLandscape(self):
return self.getType().getGroupGlobalType() is not None

def get_GroupGlobalType(self):
return self.getType().getGroupGlobalType()

Expand Down
35 changes: 26 additions & 9 deletions src/domdiv/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,23 +1478,29 @@ def drawTab(self, item, panel=None, backside=False):
tabScale = artSize / self.LABEL_HEIGHT

# whitespace
margin = padding = 2
safety = 1 # empty zone inside tab edge
padding = 3 # minimum space around text
margin = 0 # space for banner/frame artwork, if any
# most non-landscape cards have 2.5mm margins in 52.5mm banners
marginRatio = 2.5 / 52.5

# metrics from the package assets
cardType = card.getType()
if artwork:
# adjust dimensions based on the application image metrics
bannerHeight += cardType.getTabTextHeightOffset() * tabScale
# adjust for space around banners and scalloped edges
margin = tabWidth / 18
# fit text inside banner/frame graphics
margin = (tabWidth - 2 * safety) * marginRatio
if card.get_GroupGlobalType() in ("Events", "Landmarks", "Projects"):
margin *= 1.75

# cost symbol metrics
coinHeight = bannerHeight - 1 * tabScale
coinHeight = bannerHeight
costHeight = coinHeight + 4 * tabScale
costTop = costHeight + tabScale * 18 * 0.624 # Minion Std Black numeral height

# loosely align the tops of the banner text & symbols
nameTop = costTop - 0.5
nameTop = costTop - 1
setTop = costTop

# card name metrics
Expand Down Expand Up @@ -1536,15 +1542,15 @@ def drawTab(self, item, panel=None, backside=False):
imgToDraw,
1,
artHeight,
tabWidth - 2,
tabWidth - 2 * safety,
artSize,
preserveAspectRatio=False,
anchor="n",
mask="auto",
)

# initialize margins
textInset = textInsetRight = margin + padding
textInset = textInsetRight = safety + margin

# draw cost
if (
Expand All @@ -1555,7 +1561,6 @@ def drawTab(self, item, panel=None, backside=False):
and not card.isType("Trash")
):
textInset += self.drawCost(card, textInset, costHeight, scale=tabScale)
textInset += padding

# draw set image
if "tab" in self.options.set_icon:
Expand All @@ -1576,7 +1581,12 @@ def drawTab(self, item, panel=None, backside=False):
self.drawSetIcon(
setImage, tabWidth - textInsetRight, setImageHeight
)
textInsetRight += padding
# leave extra room between the set icon and text
textInsetRight += padding / 2

# add padding between the text and any icons or margins
textInset += padding
textInsetRight += padding

# draw name
textWidth -= textInset
Expand Down Expand Up @@ -1665,6 +1675,13 @@ def drawTab(self, item, panel=None, backside=False):
w = rmax
else: # centre, but keep it inside the margins
w = max(lmin, min(tabWidth / 2 - centreWidth / 2, rmax))
# use white text for Night cards
if (
"Night" in card.types
and "Action" not in card.types
and "Duration" not in card.types
):
self.canvas.setFillColorRGB(1, 1, 1)
self.drawSmallCaps(line, fontSize, w, h, style=style)

self.canvas.restoreState()
Expand Down
Binary file modified src/domdiv/images/action-shelter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/action-treasure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/action-victory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/duration-reaction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/duration-victory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/duration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/night.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/reaction-shelter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/reaction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/reserve-treasure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/reserve-victory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/reserve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/ruins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/shelter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/treasure-duration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/treasure-reaction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/treasure-victory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/treasure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/victory-reaction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/victory-shelter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/domdiv/images/victory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5785ef5

Please sign in to comment.