#font #typography #font-editor #mfek

typoscale

1, 1 1⁄10, 1 3⁄10, 1 ½, 1 7⁄10, 2, 2 ⅕, 2 ⅗, 3, 3 ⅖, 4, 4 ½, 5 ⅕, 6, 6 9⁄10, 8, 9 1⁄10, 10 ½, 12 1⁄10, 13 9⁄10, 16, 18 3⁄10, 21 1⁄10, 24 ⅕, 27 ⅘, 32, 36 7⁄10, 42 ⅕, 48 ½, 55 7⁄10, 64, 73 ½, 84 ⅖, 97, 111 ⅖, 128, 147, 168 ⅘, 194, 222 ⅘, 256

3 unstable releases

0.2.1 Feb 3, 2023
0.2.0 Feb 1, 2023
0.1.0 Feb 1, 2023

#7 in #fonts

Apache-2.0

12KB
169 lines

typoscale.rlib

The traditional typographic scale is like a musical scale, but with picas rather than octaves.

License

© 2023 Fredrick R. Brennan and MFEK Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note: GPT-3 output is included in this library's source code.


lib.rs:

Python prototype:

import math
typoscale = lambda i: 1 * 2**(i/5)
fifths=list("⅕⅖⅗⅘")
fifths=dict({i+1: fifths[i] for i in range(4)})
fifths[0]=''
tenths=["½" if i%5==0 else str(i)+"⁄10" if not i%2==0 else fifths[(i/2)] for i in range(1,10)]
tenths=dict({i+1: tenths[i] for i in range(9)})
tenths[0]=''
print(", ".join([f"{i}{tenths[int(j*10)]}" for i, j in [(math.floor(typoscale(i)), math.fmod(typoscale(i),1.0)) for i in range(0,64)]]))

Yields: 1 , 1 1⁄10, 1 3⁄10, 1 ½, 1 7⁄10, 2 , 2 ⅕, 2 ⅗, 3 , 3 ⅖, 4 , 4 ½, 5 ⅕, 6 , 6 9⁄10, 8 , 9 1⁄10, 10 ½, 12 1⁄10, 13 9⁄10, 16 , 18 3⁄10, 21 1⁄10, 24 ⅕, 27 ⅘, 32 , 36 7⁄10, 42 ⅕, 48 ½, 55 7⁄10, 64 , 73 ½, 84 ⅖, 97 , 111 ⅖, 128 , 147 , 168 ⅘, 194 , 222 ⅘, 256 , 294 , 337 7⁄10, 388 , 445 7⁄10, 512 , 588 1⁄10, 675 ½, 776 , 891 ⅖, 1024 , 1176 ⅕, 1351 1⁄10, 1552 , 1782 ⅘, 2048 , 2352 ½, 2702 3⁄10, 3104 1⁄10, 3565 7⁄10, 4096 , 4705 , 5404 7⁄10, 6208 3⁄10

Dependencies

~155KB