Skip to content

Commit

Permalink
adding more samples
Browse files Browse the repository at this point in the history
  • Loading branch information
SargisYonan committed Jul 22, 2024
1 parent 289a2ea commit e5b8075
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ FONTS_DIR := fonts
GLYPH_FILES := $(foreach dir, $(OUTPUT_DIRS), $(shell find $(dir) -name '*.glyphs' | grep -v ' (Autosaved).glyphs'))

SAMPLE_DIR := samples
SAMPLE_TEXT := "ܥܠ ܐܪܥܐ ܫܠܡܐ ܘܣܒܪܐ ܛܒܐ ܠܒܪܢܫ̈ܐ"

all: build generate-png install test

Expand Down Expand Up @@ -59,7 +58,8 @@ generate-png: venv
. venv/bin/activate && \
for file in $(FONTS_DIR)/*.otf; do \
font=$$(basename "$$file" .otf); \
python3 scripts/render_text.py "$$file" $(SAMPLE_TEXT) "$(SAMPLE_DIR)/$$font.png"; \
python3 scripts/render_text.py "$$file" "ܥܠ ܐܪܥܐ ܫܠܡܐ ܘܣܒܪܐ ܛܒܐ ܠܒܪܢܫ̈ܐ" "$(SAMPLE_DIR)/$$font.png"; \
python3 scripts/render_text.py "$$file" "ܢܘܗܕܪܐ" "$(SAMPLE_DIR)/$$font-nohadra-sample.png"; \
done

.PHONY: clean test install build open venv all generate-svg generate-png
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
![CI Status](https://github.com/SargisYonan/NohadraSyriacFonts/actions/workflows/fontbakery.yml/badge.svg)

Nohadra fonts are a bold, geometric, and monospaced Syriac typeface.
![Nohadra - Sapna](samples/NohadraSyriac-Sapna-nohadra-sample.png)
![Nohadra - Amedia](samples/NohadraSyriac-Amedia-nohadra-sample.png)

## Introduction

Expand Down
Binary file added samples/NohadraSyriac-Amedia-nohadra-sample.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 samples/NohadraSyriac-Amedia.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 added samples/NohadraSyriac-Sapna-nohadra-sample.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 samples/NohadraSyriac-Sapna.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions scripts/render_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ def clean_text(text):
return ''.join(c for c in text if unicodedata.category(c).startswith('L') or c.isspace())

def render_text_to_image(font_path, text, output_path):
width, height = 4600, 500

font_size = 400

width = int((len(text)*font_size) / 2.5)
height = 350

# Create a new image with a white background
image = Image.new('RGB', (width, height), color='white')
Expand All @@ -18,15 +22,14 @@ def render_text_to_image(font_path, text, output_path):
reshaped_text = arabic_reshaper.reshape(clean_text(text))

# Load the font
font_size = 400
font = ImageFont.truetype(font_path, font_size)

# Calculate text width and height for centering
draw = ImageDraw.Draw(image)
bbox = draw.textbbox((0, 0), reshaped_text, font=font)
text_width, text_height = bbox[2] - bbox[0], bbox[3] - bbox[1]
text_x = (width - text_width) // 2
text_y = ((height - text_height) // 2) - text_height/2
text_y = ((text_height) // 2) - text_height

# Draw the text on the image
text_color = (0, 0, 0) # Black color
Expand Down

0 comments on commit e5b8075

Please sign in to comment.