Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/fonts/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 𝑭𝘰𝔫𝘁𝓼 Galore
This package allows you to replace any old text with a fancified version using fonts!

## Installation
Comment thread
smeech marked this conversation as resolved.
Install this package using
```sh
espanso install fonts
```

## Usage
This package replaces text found, up to a final colon, with the same text, but fancified using the specified font.

In order for this font to work, you may need to install Python 3 in order to allow the script to run. You can view a tutorial to do that [here](https://www.reddit.com/r/learnpython/comments/8lkmjf/python_3_installation_guide/).

This package also may not be as useful given the Espanso regex limit, which is set to 30 by default. To change this (**highly recommended**), navigate to the Espanso config file and adjust `max_regex_buffer_size:` to a higher value, I recommend anywhere from 500 - 2000 (*note that this will increase Espanso's memory usage*).

| Shortcut | Name | Example |
|--------------| - | - |
| :b 𝘵𝘦𝘹𝘵: | Bold | 𝗟𝗼𝗿𝗲𝗺 𝗜𝗽𝘀𝘂𝗺 |
| :i 𝘵𝘦𝘹𝘵: | Italics | 𝘓𝘰𝘳𝘦𝘮 𝘐𝘱𝘴𝘶𝘮 |
| :s 𝘵𝘦𝘹𝘵: | Script | 𝓛𝓸𝓻𝓮𝓶 𝓘𝓹𝓼𝓾𝓶 |
| :g 𝘵𝘦𝘹𝘵: | Gothic | 𝔏𝔬𝔯𝔢𝔪 ℑ𝔭𝔰𝔲𝔪 |
| :f 𝘵𝘦𝘹𝘵: | Fancy | 𝑳𝒐𝒓𝒆𝒎 𝑰𝒑𝒔𝒖𝒎 |
7 changes: 7 additions & 0 deletions packages/fonts/0.1.0/_manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "fonts"
title: "Fonts"
description: A package to convert text to fancy fonts anywhere on your computer!
version: 0.1.0
author: SirAardvark
tags: ["Fun", "Writing"]
Comment thread
smeech marked this conversation as resolved.
homepage: "https://github.com/S1rAardvark/font-package"
31 changes: 31 additions & 0 deletions packages/fonts/0.1.0/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
matches:
Comment thread
smeech marked this conversation as resolved.
- regex: ":(?P<style>[bisgf]) (?P<text>[^:]+):"
replace: "{{output}}"
vars:
- name: output
type: script
params:
args:
- python
- -c
- |
import sys, codecs

# Ensure UTF-8 output
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())

style_map = {
'b': '𝗮𝗯𝗰𝗱𝗲𝗳𝗴𝗵𝗶𝗷𝗸𝗹𝗺𝗻𝗼𝗽𝗾𝗿𝘀𝘁𝘂𝘃𝘄𝘅𝘆𝘇𝗔𝗕𝗖𝗗𝗘𝗙𝗚𝗛𝗜𝗝𝗞𝗟𝗠𝗡𝗢𝗣𝗤𝗥𝗦𝗧𝗨𝗩𝗪𝗫𝗬𝗭𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵 ',
'i': '𝘢𝘣𝘤𝘥𝘦𝘧𝘨𝘩𝘪𝘫𝘬𝘭𝘮𝘯𝘰𝘱𝘲𝘳𝘴𝘵𝘶𝘷𝘸𝘹𝘺𝘻𝘈𝘉𝘊𝘋𝘌𝘍𝘎𝘏𝘐𝘑𝘒𝘓𝘔𝘕𝘖𝘗𝘘𝘙𝘚𝘛𝘜𝘝𝘞𝘟𝘠𝘡0123456789 ',
's': '𝓪𝓫𝓬𝓭𝓮𝓯𝓰𝓱𝓲𝓳𝓴𝓵𝓶𝓷𝓸𝓹𝓺𝓻𝓼𝓽𝓾𝓿𝔀𝔁𝔂𝔃𝓐𝓑𝓒𝓓𝓔𝓕𝓖𝓗𝓘𝓙𝓚𝓛𝓜𝓝𝓞𝓟𝓠𝓡𝓢𝓣𝓤𝓥𝓦𝓧𝓨𝓩0123456789 ',
'g': '𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ0123456789 ',
'f': '𝒂𝒃𝒄𝒅𝒆𝒇𝒈𝒉𝒊𝒋𝒌𝒍𝒎𝒏𝒐𝒑𝒒𝒓𝒔𝒕𝒖𝒗𝒘𝒙𝒚𝒛𝑨𝑩𝑪𝑫𝑬𝑭𝑮𝑯𝑰𝑱𝑲𝑳𝑴𝑵𝑶𝑷𝑸𝑹𝑺𝑻𝑼𝑽𝑾𝑿𝒀𝒁0123456789 '
}

src = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '
text_to_convert = r'''{{text}}'''
style_key = '{{style}}'

if style_key in style_map:
Comment thread
smeech marked this conversation as resolved.
table = str.maketrans(src, style_map[style_key])
print(text_to_convert.translate(table), end='')