weekly_challenges

所属分类:内容生成
开发工具:TeX
文件大小:0KB
下载次数:0
上传日期:2023-09-20 00:34:05
上 传 者sh-1993
说明:  为Glyphs和Alphabets discord服务器生成与质询相关的图像。,
(Generates challenge-related images for the Glyphs and Alphabets discord server.,)

文件列表:
LICENSE (11357, 2023-12-12)
fontdata.json (8352, 2023-12-12)
sample_images/ (0, 2023-12-12)
sample_images/AmbiWinnerFirst.png (51123, 2023-12-12)
sample_images/AmbiWinnerSecond.png (27497, 2023-12-12)
sample_images/AmbiWinnerThird.png (26630, 2023-12-12)
sample_images/Ambi_1.jpg (27497, 2023-12-12)
sample_images/Ambi_2.png (51123, 2023-12-12)
sample_images/Ambi_3.png (26630, 2023-12-12)
sample_images/GlyphWinnerFirst.png (297662, 2023-12-12)
sample_images/GlyphWinnerSecond.png (37583, 2023-12-12)
sample_images/GlyphWinnerThird.png (63129, 2023-12-12)
sample_images/Glyph_1.png (19633, 2023-12-12)
sample_images/Glyph_2.jpg (79272, 2023-12-12)
sample_images/Glyph_3.jpg (37583, 2023-12-12)
sample_images/Glyph_4.png (63129, 2023-12-12)
sample_images/Glyph_5.png (297662, 2023-12-12)
sample_images/pfp/ (0, 2023-12-12)
sample_images/pfp/dogg.png (28516, 2023-12-12)
sample_images/pfp/nope.jpg (17919, 2023-12-12)
sample_images/pfp/the_uwuji.png (34101, 2023-12-12)
utility.py (5847, 2023-12-12)
weekly_challenges.py (14550, 2023-12-12)
weekly_challenges_base.tex (35352, 2023-12-12)

# weekly_challenges.py Generates challenge-related images for the Glyphs and Alphabets discord server. Assumes a Linux environment, and invokes `pdftoppm`, `convert` (part of `imagemagick`), `lualatex` and `fc-match` (for local font information). All images should be stored in a folder named `Images`. For quick testing, copy `sample_images` to `Images`. The usage examples below use the sample images. The format of this directory is as follows: * Glyph submissions should have the filenames `Glyph_1`, `Glyph_2`, etc (with any image file extension). * Ambigram submissions are likewise `Ambi_1`, `Ambi_2`, etc. * User profile pictures should have filenames matching the user's names and should be stored in a subdirectory `Images/pfp`. Note that LaTeX doesn't like the characters `&%$#{}~^\` in filenames, so for now these should simply be stripped from stored usernames. * The winning submissions should be copied to files named `GlyphWinnerFirst`, `GlyphWinnerSecond`, `GlyphWinnerThird` for the glyph challenge, and likewise `AmbiWinnerFirst`, `AmbiWinnerSecond`, `AmbiWinnerThird` for the ambigram challenge (with the appropriate file extensions). For the full list of available options, consult ```weekly_challenges.py -h``` which will give a list of subcommands and a brief description of their usage, and ```weekly_challenges.py -h``` for detailed description of one particular subcommand. The LaTeX code in this repo is coauthored by one `doggo`. ## Table of Contents - [Example Usage](https://github.com/sungodmoth/weekly_challenges/blob/master/#example-usage) - [Font Selection](https://github.com/sungodmoth/weekly_challenges/blob/master/#font-selection) ## Example Usage The following examples cover all of the glyph challenge-related commands, and the equivalent ambigram challenge commands work identically (with `ambigram` in place of `glyph`). ``` >>> weekly_challenges.py glyph_announcement ``` Date and background colour (which is on a weekly cycle) are automatically determined. For this example character, the font `Noto Emoji` is automatically selected and will be used so long as it is present on the system (if you get an error with this particular character, it's likely that `Noto Color Emoji`, which is more widely installed but will not work here, is being chosen instead). The font and font size can be overriden with the `--font` and `--size` flags, in this subcommand and several others.
``` >>> weekly_challenges.py glyph_poll ``` Glyph submissions are pulled from the `Images` directory as explained above. The number of columns, in this and other grid-related subcommands, is determined automatically but can be overriden by `--cols`.
``` >>> weekly_challenges.py glyph_first dogg >>> weekly_challenges.py glyph_second the_uwuji >>> weekly_challenges.py glyph_third nope ``` Winning submissions are pulled from the appropriately named files in `Images` as explained above, and user profile pictures are likewise pulled from the images in `Images/pfp` with the same filenames as the usernames you pass in.
``` >>> weekly_challenges.py glyph_suggestions a 木 爨 さ ``` Suggestions are separated by spaces, and each one has a font auto-selected. Overriding these fonts and their sizes is not yet supported.
## Font Selection Automatic font selection proceeds according to the file `font_data.json`, which contains a list of fonts. Each font must be present on the system (as a `.ttf` or `.otf` in the relevant system directories, not just within the LaTeX installation), so that the `fontconfig` tool `fc-match` can be used to automatically determine which glyphs it supports (the exception is STIX Two Text, the main font of the document, whose glyph support has been hardcoded for convenience as it is rarely present outside of LaTeX). The order of fonts within the file is significant because each string will be displayed in the *first* font in the list which supports *all* of its Unicode characters. There are also a few additional flags which can be attached to a font: * `"load_as"` is used for internal LaTeX font loading and can be mostly ignored. * `"excludes"` can be used to dictate that even if a font supports a glyph in a given Unicode range, it will not be used for it, meaning that font selection will proceed further down the list. For example, `BabelStone Han` is set as the preferred font for Han characters, but is not the preferred font for several other Unicode blocks for which it has partial or full support, including Japanese kana. Excluding these ranges allows us to keep `BabelStone Han` above all other Han fonts without also prioritising its other glyphs. * `"size_percentage"` can be used if a font has consistently oversized or undersized glyphs that would otherwise necessitate frequent manual overrides. It is a simple multiplier, expressed as a percentage, that will be applied whenever the font is automatically selected by the font selection algorithm. Note that if the same font is selected manually, the multiplier will not be applied.

近期下载者

相关文件


收藏者