Merge pull request 'lowercasing_folders' (#2) from lowercasing_folders into main

Reviewed-on: fonts/fonts#2
This commit is contained in:
Matt Troutman 2024-10-03 00:47:16 -05:00
commit 7f982826c5
572 changed files with 247 additions and 42 deletions

View file

@ -3,6 +3,8 @@ import time
from fileinput import filename
repo_location = '/Users/fishy/custom_fonts'
os.system(f"cd ")
font_location = f'{repo_location}/font_files'
bad_phrases = [' Free',
@ -135,7 +137,7 @@ def collect_orphaned_fonts(path=font_location):
def lowercase_all_the_folders(root_path=font_location):
"""
Lowercases all the folders in the root path, except those starting with a period.
Lowercases all the folders recursively in the root_path.
Args:
root_path (str): The path to the directory to be checked and cleaned.
@ -143,15 +145,14 @@ def lowercase_all_the_folders(root_path=font_location):
Returns:
None
"""
for dir in os.listdir(root_path):
dir_path = os.path.join(root_path, dir)
if os.path.isdir(dir_path):
if dir.startswith('.'):
continue
new_dir_path = os.path.join(root_path, dir.lower())
for root, dirs, files in os.walk(root_path):
for dir in dirs:
dir_path = os.path.join(root, dir)
new_dir_path = os.path.join(root, dir.lower())
os.rename(dir_path, new_dir_path)
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
def add_font_folders_to_each(root_path=font_location):
for dir in os.listdir(root_path):
dir_path = os.path.join(root_path, dir)
@ -221,13 +222,16 @@ def remove_setup_complete_files(root_path=font_location):
print(f"Removed .setup_complete file: {file_path}")
def remove_spaces_in_dir_names(root_path=font_location):
for dir in os.listdir(root_path):
dir_path = os.path.join(root_path, dir)
if os.path.isdir(dir_path):
#If directory name contains spaces, replace them with dashes
for root, dirs, files in os.walk(root_path, topdown=False):
for dir in dirs:
dir_path = os.path.join(root, dir)
if ' ' in dir:
new_dir = dir.replace(' ', '-')
new_dir_path = os.path.join(root_path, new_dir)
#lowercase the new directory name
while new_dir.endswith('-'):
new_dir = new_dir[:-1]
new_dir = new_dir.lower()
new_dir_path = os.path.join(root, new_dir)
os.rename(dir_path, new_dir_path)
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
@ -243,25 +247,65 @@ def prepend_folder_name_to_font_dash(root_path=font_location):
os.rename(dir_path, new_dir_path)
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
def lowercase_and_dash_file_names(root_path=font_location):
for root, dirs, files in os.walk(root_path):
for file in files:
file_path = os.path.join(root, file)
new_file_path = os.path.join(root, file.lower())
#let's also remove spaces in the file names
# Remove spaces in the file names
new_file_path = new_file_path.replace(' ', '-')
os.rename(file_path, new_file_path)
print(f"Renamed file: {file_path} -> {new_file_path}")
# Check if the file exists before renaming
if os.path.exists(file_path):
os.rename(file_path, new_file_path)
print(f"Renamed file: {file_path} -> {new_file_path}")
else:
print(f"File not found: {file_path}")
def dont_use_dots_for_font_files(root_path=font_location):
for root, dirs, files in os.walk(root_path):
for file in files:
file_path = os.path.join(root, file)
extensions = ['.otf', '.ttf', '.ttc', '.pdf', '.woff', '.woff2']
if any(file_path.endswith(ext) for ext in extensions):
new_file_path = None
for x in ['.','_', ' ', '-', '.-','--']:
if file.startswith(x):
new_file_path = os.path.join(root, file.lstrip(x))
if not os.path.exists(new_file_path):
os.rename(file_path, new_file_path)
print(f"Renamed file: {file_path} -> {new_file_path}")
else:
print(f"Skipped renaming {file_path} as {new_file_path} already exists")
new_file_path = None
def remove_double_and_triple_dashes(root_path=font_location):
## remove double and triple dashes from file names
## should loop until no more double or triple dashes are found
for root, dirs, files in os.walk(root_path):
for file in files:
file_path = os.path.join(root, file)
#replace -- or --- with -
if '--' in file or '---' in file:
new_file = file.replace('--','-')
new_file = new_file.replace('---','-')
new_file_path = os.path.join(root, new_file)
os.rename(file_path, new_file_path)
print(f"Renamed file: {file_path} -> {new_file_path}")
if __name__ == '__main__':
remove_ds_store_files()
remove_empty_folders()
remove_bad_phrases()
collect_orphaned_fonts()
remove_bad_phrases()
lowercase_all_the_folders()
# add_font_folders_to_each()
remove_spaces_in_dir_names()
lowercase_and_dash_file_names()
prepend_folder_name_to_font_dash()
dont_use_dots_for_font_files()
remove_double_and_triple_dashes()
remove_double_and_triple_dashes()
remove_ds_store_files()
remove_empty_folders()

View file

@ -1,6 +0,0 @@
#!/bin/zsh
# go to the root of the repository
cd "$(git rev-parse --show-toplevel)"
# reset the repository to the main branch and clean it
git reset --hard main
git clean -fdx -e .env/ -e .idea/

View file

@ -0,0 +1,51 @@
import os
import subprocess
import sys
def main():
mydir = os.path.dirname(__file__)
# Define the absolute path to the prep script
prep_script = os.path.join(mydir, 'prep 1 font.sh')
# Activate python environment
env_activate = os.path.join(mydir, '.env/bin/activate')
subprocess.run(['source', env_activate], shell=True, check=True)
# Move orphans before we do anything else
orphans_script = os.path.join(mydir, 'orphans.py')
subprocess.run(['python3', orphans_script], check=True)
# Check if the prep script exists
if not os.path.isfile(prep_script):
print(f"Prep script not found: {prep_script}")
sys.exit(1)
# Ensure the prep script is executable
os.chmod(prep_script, 0o755)
# Check if the prep script is executable
if not os.access(prep_script, os.X_OK):
print(f"Prep script not executable: {prep_script}")
sys.exit(1)
# Define the absolute path to the font_files directory
font_files_dir = os.path.join(mydir, 'font_files')
# Check if the font_files directory exists
if not os.path.isdir(font_files_dir):
print(f"font_files directory not found: {font_files_dir}")
sys.exit(1)
# Iterate over each folder in font_files
for folder in os.listdir(font_files_dir):
folder_path = os.path.join(font_files_dir, folder)
if os.path.isdir(folder_path):
os.chdir(folder_path)
subprocess.run(['zsh', prep_script], check=True)
os.chdir('..')
else:
print(f"No such directory: {folder}")
if __name__ == '__main__':
main()

View file

@ -21,8 +21,8 @@ fi
#recursively find all .zip files and unzip them
find . -name '*.zip' -exec unzip {} \;
# Make OTF and TTF folders if they don't exist
mkdir -p OTF TTF "other files"
# Make otf and ttf folders if they don't exist
mkdir -p otf ttf "other files"
# Recurse through all folders and subfolders and move files that are not .ttf or .otf into the "other files" folder
find . -type f -exec mv {} "other files" \;
@ -35,12 +35,12 @@ find . -name '*.ofm' -type f -delete
find . -name '*.cfg' -type f -delete
find . -name '*.zip' -type f -delete
# Recurse through all folders and subfolders and move all .ttf files into the TTF folder
find . -name '*.ttf' -type f -exec mv {} TTF \;
# Recurse through all folders and subfolders and move all .ttc files into the TTF folder
find . -name '*.ttc' -type f -exec mv {} TTF \;
# Recurse through all folders and subfolders and move all .otf files into the OTF folder
find . -name '*.otf' -type f -exec mv {} OTF \;
# Recurse through all folders and subfolders and move all .ttf files into the ttf folder
find . -name '*.ttf' -type f -exec mv {} ttf \;
# Recurse through all folders and subfolders and move all .ttc files into the ttf folder
find . -name '*.ttc' -type f -exec mv {} ttf \;
# Recurse through all folders and subfolders and move all .otf files into the otf folder
find . -name '*.otf' -type f -exec mv {} otf \;
# Recurse through all folders and subfolders and delete all empty folders
find . -type d -empty -delete

View file

@ -1,9 +1,17 @@
import font_folder_cleanup
import os
def git_cleanup():
os.system("cd $(git rev-parse --show-toplevel) && git stash push -- .fontfoldercleanup/ && git reset --hard && git clean -fdx -e .env/ -e .idea/ -e .fontfoldercleanup/")
def apply_stash():
os.system("cd $(git rev-parse --show-toplevel) && git stash apply")
if __name__ == '__main__':
# Clean up git repository
os.system("./git_reset_and_clean.sh") # Change to repo location, reset the repository, and clean untracked files except those in .gitignore
cleanup.remove_ds_store_files() # Remove .DS_Store files from the repository
cleanup.remove_setup_complete_files() # Remove setup complete files from the repository
cleanup.remove_empty_folders() # Remove empty folders from the repository
git_cleanup() # Clean up git repository
font_folder_cleanup.remove_ds_store_files() # Remove .DS_Store files from the repository
font_folder_cleanup.remove_setup_complete_files() # Remove setup complete files from the repository
font_folder_cleanup.remove_empty_folders() # Remove empty folders from the repository
git_cleanup() # Clean up git repository again after removing files and folders
apply_stash() # Apply the stash to restore the files that were removed

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,100 @@
-------------------------------------------------
Tom Chalky Font EULA (End User License Agreement)
-------------------------------------------------
I understand that reading EULAs (End User License Agreements) can be a chore but I have tried my best to make my terms very clear and reasonable to keep both parties happy. Of course if there are any questions left unanswered you can contact me using the information in section E and I will try and clarify anything for you.
Also, if you have any suggestions regarding my EULA please again use the information in section E to get in touch. My main priority is to satisfy you to the best of my ability and to make my agreement as real world friendly as possible.
By installing any font software created by or under the name of Tom Chalky, you are indicating that you agree that the font software remains the exclusive property of Tom Chalky and that you have the correct licensing in place to protect the use of the font software under the following terms and conditions.
-------------------
A - Number of CPU's
-------------------
A1 - You can install the font(s) on one (1) portable device such as a notebook or laptop computer and on one (1) device that remains at a single location such as a desktop computer. These devices can be connected to any number of physical outputs. The physical output can be an inkjet printer, laser printer, offset press, silk screener, vinyl cutter, die-maker etc.
A2 - If you want to license my fonts for more than what is stated in A1 (one (1) user, one (1) stationary CPU and one (1) transportable CPU), you must upgrade your license to a multiple-user license. A multiple-user license includes the exact same terms as a standard license, but with a higher number of devices and users allowed. To find out how to attain a multiple-user license, refer to section F1.
----------------------------------------------
B - Standard Permissions and Special Licensing
----------------------------------------------
B1 - Use with any software: You can use my fonts with any software that supports them. This includes mainstream software such as Microsoft, Adobe, Macromedia or any other software retailer's programs, or software you or your company may have had custom-made.
B3 - Prepress Allowance: You can send my fonts to your printing services, but after the job has been completed please ensure that they remove the fonts from their systems as they will probably end up using them on other jobs, which reduce the value of the fonts we created and you paid for.
B4 - Embedding Permissions: You can embed my fonts in certain electronic documents. This includes PDF, Flash and Microsoft Office documents (such as Word or PowerPoint), or multimedia files, but if at all possible, please make sure that you do not embed the complete character set. Fonts embedded in electronic documents can usually be extracted and pirated, I obviously would rather that didnt happen.
B5 - ePub Licensing: The embedding and use of my fonts in commercial electronic publications such as eBooks require a special kind of licensing. For more information regarding ePub Licensing divert your attention to section F2.
B6 Web Font Licensing: You can use my fonts for simple web-related tasks, like making raster images or navigation elements to display on your web page. If you want to use my fonts as “webfonts”, whereby you include them in your site's CSS code so that they appear live in web site documents, you must obtain a web font license. To obtain a web font license, please refer to section F3.
B7 Web App Licensing: If you want to make my fonts available as part of a dynamic interface for a server-based program (such as a Flash or PHP/Javascript program), or include them in a web browser-based program, you must obtain a special web application license. This license can be obtained by contacting us, see section F4 for more information regarding the web app license.
B8 Printing our Fonts: You can use my fonts to print artwork on clothes, cars, mugs, fridge magnets or any other products that you, your company, or your clients are selling.
B9 Non-Digital 3D Shapes/Products: You can use my fonts to make non-digital 3-dimensional shapes, rubber stamps or scrapbooking alphabets that you can sell.
B10 Corporate Identity and Branding: You can use my fonts to produce artwork meant to be part of a corporate identity or branding. This includes letterheads, business cards, business forms, banners, film titling, tie-in products, etc. However Logos are excluded from the list. If you intend on using the font for a logo design, please get in touch via our email stated in section E.
B11 Backups: You can keep one backup copy of any my font you have licensed, but the backup medium you use should be secure and only privately accessible.
B12 Modification: You can modify my fonts, but only for uses outlined within the condition of this license and as long as the modifications are being done by yourself. Modification also means font format conversion. If you have a Mac and a PC, you can use conversion software to convert the font between platforms. Third parties to this license are not allowed to modify my fonts under any circumstance, unless formally authorized in writing by Tom Chalky.
B13 Internal Usage: You can install my fonts to be served internally to users at your company, provided that you have purchased the appropriate license for the amount of users who will have access to the font/s. Please also review the Multi-User License section and the pricing structure in section F1. All users must be covered with the license.
B14 Distribution: You cannot give away copies of my fonts in ways that do not comply with the rest of this agreement. For example: you cannot make any my fonts available for download on the internet, email them to your friends, upload them to public internet file transfer or storing channels. Please respect the value of what we do, so that we keep having an incentive to continue.
B15 Reselling: You cannot resell my fonts through any medium unless you have written authorisation from Tom Chalky to be a distributor. This also means you cannot modify my fonts then sell the resulting modification.
B16 Usage not mentioned? If you are wondering about a particular type of usage we didn't include in this agreement, just drop us a line and we will try our hardest to help. See section E for a way get in touch.
----------------------
C) Support and Updates
----------------------
C1 Quality Check: All of my fonts undergo thorough testing before they are available for licensing, but if I did something wrong and the font you licensed doesn't perform properly or up to your expectations, I will replace it with a satisfactory copy. Please make sure you include the order number or have the purchase receipt available when you ask for an exchange.
C2 Free Lifetime Support: All my fonts come with free lifetime support. However I cannot offer support for fonts that have been modified in any way as I am not familiar with how they were modified and cannot be held responsible for the aftermarket editing process.
C3 Updates: All of my fonts come with free lifetime version updates. This is made easier if you register an account with me when you purchase your font licenses as your purchase history is stored on your account and is re-downloadable at any time. All available downloads are updated at the source, and updates will be applied to the downloads available on your account. I promise to keep providing free version upgrades for as long as my fonts exists.
-----------------------
D) Miscellaneous Notes:
-----------------------
D1 - If you don't agree with some of my license terms, please discuss the issue with myself. I am always open to new ways of providing you with better service. I am a small independent design studio that thrives only by keeping my customers happy so that they come back for more. I believe that fonts with unreasonable restrictions do not ultimately contribute to anyone's satisfaction, so I try my best to keep my licensing adaptable to as many workflows as possible.
D2 - My fonts are made to be used how fonts are normally used. I can guarantee and support their functionality as fonts, but not as anything else. I cannot take responsibility for incidental damages arising from my fonts being used in any application or in a certain way. Also I cannot take responsibility for a user's level of experience in using fonts within certain workflows.
-----------------------
E Contact Information
-----------------------
Email Tomchalkys@gmail.com
------------------------------
F Special Licensing Pricing:
------------------------------
F1 Multi-User License: To obtain a Multi-User License with any of my fonts, simply purchase the same quantity of fonts as you need users by altering the quantity section on my checkout page.
For example, If 10 users are going to be using our Bobby Jones Font ($30 with a single user license) you will need to buy Bobby Jones to the Quantity of 10 totalling to $300.
F2 - ePub Licensing Table:
Below is the ePub License pricing model, please note that multi-user licensing still applies to the number of users, regardless of the number of publications being licensed. To obtain this license, you must contact me directly. Refer to section E.
# of ePubs Price x Base Price:
1 (x 10)
2-5 (x 20)
6-20 (x 35)
21-50 (x 50)
Unlimited (x 200)
F3 Webfont Licensing:
A Webfont license can be purchased directly through the store, simply navigate to your selected font and select Webfont in the drop down box, the price will be the same as the Desktop license but will not cover any Desktop usage. If you require both licenses, please purchase both by following the same method and select Desktop + Webfont. Available formats (EOT, WOFF, WOFF2).
F4 Web App Licensing
Licensing my fonts for web application integration is priced per application, with an option to license for unlimited applications. The price per application is 50x base price. The unlimited application option is 200x base price. Contact me directly to obtain this license. Refer to section E.

View file

@ -0,0 +1,10 @@
If I could personally thank every person that downloaded one of my fonts I really would, but unfortunately that's just not possible. However, I do try my best to show my appreciation with newsletter exclusive free fonts and limited time coupons only for those that subscribe and follow me on this creative entrepreneurial journey.
So, would you do me the honor of subscribing to my newsletter (http://eepurl.com/beQLFL), it's completely free and within a few days you'll receive some great free downloads that I think you will love!
Have a great week!
Tom Chalky
-----------
Any questions or fancy a chat, get in touch: tomchalkys@gmail.com
-----------

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,5 @@
Thank-you for downloading the Bouncy Castle font family! If you have any questions, please do not hesitate to email me tom@tomchalky.com
This copy of Bouncy Castle is free for personal use - visit https://tomchalky.com/the-personal-license/ for more information regarding my personal licesne
A Commercial License can be purchased here - https://tomchalky.com/bouncy-castle-font-family/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more