-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dadav
committed
Apr 2, 2020
1 parent
5bac678
commit 0dedd09
Showing
17 changed files
with
40 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,38 @@ | ||
from PIL import ImageFont | ||
|
||
FONT_NAME = None | ||
FONT_NAME_FACES = 'DejaVuSansMono' | ||
# should not be changed | ||
FONT_NAME = 'DejaVuSansMono' | ||
|
||
# can be changed | ||
STATUS_FONT_NAME = None | ||
SIZE_OFFSET = 0 | ||
|
||
Bold = None | ||
BoldSmall = None | ||
BoldBig = None | ||
Medium = None | ||
Small = None | ||
Huge = None | ||
FaceHuge = None | ||
FaceBold = None | ||
|
||
|
||
def init(config): | ||
global FONT_NAME, SIZE_OFFSET | ||
FONT_NAME = config['ui']['font']['name'] | ||
global STATUS_FONT_NAME, SIZE_OFFSET | ||
STATUS_FONT_NAME = config['ui']['font']['name'] | ||
SIZE_OFFSET = config['ui']['font']['size_offset'] | ||
setup(10, 8, 10, 25, 25, 9) | ||
|
||
|
||
def setup(bold, bold_small, medium, huge, bold_big, small): | ||
global Bold, BoldSmall, Medium, Huge, BoldBig, Small, FaceHuge, FaceBold, FONT_NAME, FONT_NAME_FACES, SIZE_OFFSET | ||
|
||
Small = ImageFont.truetype("%s.ttf" % FONT_NAME, small + SIZE_OFFSET) | ||
Medium = ImageFont.truetype("%s.ttf" % FONT_NAME, medium + SIZE_OFFSET) | ||
FaceHuge = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME_FACES, huge) | ||
FaceBold = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME_FACES, bold) | ||
|
||
try: | ||
BoldSmall = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold_small + SIZE_OFFSET) | ||
Bold = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold + SIZE_OFFSET) | ||
BoldBig = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold_big + SIZE_OFFSET) | ||
Huge = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, huge + SIZE_OFFSET) | ||
except OSError: | ||
BoldSmall = ImageFont.truetype("%s.ttf" % FONT_NAME, bold_small + SIZE_OFFSET) | ||
Bold = ImageFont.truetype("%s.ttf" % FONT_NAME, bold + SIZE_OFFSET) | ||
BoldBig = ImageFont.truetype("%s.ttf" % FONT_NAME, bold_big + SIZE_OFFSET) | ||
Huge = ImageFont.truetype("%s.ttf" % FONT_NAME, huge + SIZE_OFFSET) | ||
def status_font(old_font): | ||
global STATUS_FONT_NAME, SIZE_OFFSET | ||
return old_font.font_variant(font=STATUS_FONT_NAME, size=old_font.size + SIZE_OFFSET) | ||
|
||
|
||
def setup(bold, bold_small, medium, huge, bold_big, small): | ||
global Bold, BoldSmall, Medium, Huge, BoldBig, Small, FONT_NAME | ||
|
||
Small = ImageFont.truetype("%s.ttf" % FONT_NAME, small) | ||
Medium = ImageFont.truetype("%s.ttf" % FONT_NAME, medium) | ||
BoldSmall = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold_small) | ||
Bold = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold) | ||
BoldBig = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, bold_big) | ||
Huge = ImageFont.truetype("%s-Bold.ttf" % FONT_NAME, huge) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters