4

crepererum - Typographic Redesign

 3 years ago
source link: https://crepererum.net/typography/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Typographic Redesign

2021-08-28
cover

It all started with a recommendation of a friend, that was to never read The Elements of Typographic Style shortly before you have to finish something. Since then I have finished many things so it was time for insightful procrastination. I read the book and now I cannot unsee it. Bad typography – everywhere, but especially in tech. So I had to redesign this blog. After consulting The Elements of Typographic Style Applied to the Web which was partially helpful, I spend hours if not days on it. And here it is: the grand redesign.

Constraints

A blog is not a printed book. The size can change due to different screens and orientations, fonts can change due to user preferences, people can zoom the page, people might for some reason disable JavaScript, accessibility must be kept in mind, etc. On top of that I do not have the resources to spend as much time into a post as someone would spend into a book page. Posts in this blog are simply typed in CommonMark (Markdown) and are rendered by Zola. The base theme is Even so I do not need to design the entire layout. Most of the design work should be done in CSS for efficiency reasons.

So every solution I come up here must work comfortably under these constraints. Sure the result might not be as beautiful in all cases – e.g. I cannot fix small-resolution screens or bad user font choices – but at least the whole things should not blow up when disturbed slightly.

Page Layout

One important aspect to get right – at least according to Robert Bringhurst is the vertical flow or rhythm. Everything on the page has to be aligned to the line height of the next, so if you would put it next to a page filled with text, lines would be aligned. To check that this is indeed the case, click here.

Note that this works better in Firefox than in Chrome. The latter just decided to do really inconsistent subpixel rendering, e.g. making paragraph lines sightly smaller than full pixels but use full pixels for margins.

Paragraphs

Paragraphs in web are by default somewhat ugly. They always come with huge margins, are cluttered, and the text has no flow whatsoever. I have fixed all of these things. This only works as of recently, because browsers did not support hyphenation that well the last time I have checked. And there is some JavaScript-driven backup through Hyphenopoly in place.

Since paragraphs do not have horizontal margins any longer, I am using the good old bookstyle indentation to separate them which gives the page a more even look.

Numbered Lists

  1. Directly after heading. Note how numbers are places outside the paragraph boundaries. Numbers are oldstyle proportional and are separated from the text solely by an en dash. No additional dot is needed.

The paragraph afterwards is not indented.

And another list to for demonstration:

  1. First item
  2. Second item that is very long and should hopefully occupy at least a few lines to illustrate how it is also justified and hyphens work. This is important for very long list items since they shall fit well into the overall structure of the page. Imagine what would happen if lists would out of the sudden look very different than ordinary paragraphs…
  3. Third item
    1. With sublist
      1. Further down
  4. Forth item
    • not numbered

Unordered Lists

  • Directly after heading. Note how numbers are places outside the paragraph boundaries. Instead of the browser-provided disk the bullet symbol • that comes with the font is used which is separated from the text by an en dash.

The paragraph afterwards is not indented.

And another:

  • First item
  • Second item that is very long and should hopefully occupy at least a few lines to illustrate how it is also justified and hyphens work. This is important for very long list items since they shall fit well into the overall structure of the page. Imagine what would happen if lists would out of the sudden look very different than ordinary paragraphs…
  • Third item
    • With sublist
      • Further down
  • Forth item
    1. numbered

Table

DirectlyAfterTheHeading

The paragraph afterwards is not indented. Tables are stripped down to the minimum which means no lines, shadows, or cell background colors. Padding is organized in a way so that the rhythm is kept.

And another one:

No AlignRight AlignLeft AlignJustifiedSome content42…FooAnother line1337fooBar

Images

Ratio 1 to 10

The one above is quite tall (ration 1:10). I try to expand all images to the same width as the paragraphs. If they get too large by doing so (measured in number of lines), they are centered. They should – as all the other elements – occupy a fixed number of lines. I do not want to mess with the aspect ratio or trim the image though. Instead I add a some additional margin at the bottom. So if for example an image occupies 8.3 lines, there will be an additional margin of 0.7 lines. Sadly this is not possible with pure CSS or other HTML trickery, so I have some small JavaScript running that first measures the pixel-equivalent of a single line and then uses this value to create the additional margin for every image. For users without JavaScript that means they cannot enjoy this effect, but it won’t break the entire site.

Note the simplicity of the images: no border, no shadow, no additional background. The latter one is also important for images with transparent elements like diagrams.

Here is one in 1:1:

Ratio 1 to 1

And here one with 9:1:

Ratio 10 to 1

And here one with 10:1:

Ratio 10 to 1

Maths

∫−∞∞1σ2πe(x−μσ)2dx=1\int_{-\infty}^{\infty} \frac{1}{\sigma \sqrt{2\pi}} e^{\left(\frac{x-\mu}{\sigma}\right)^2} dx = 1∫−∞∞​σ2π​1​e(σx−μ​)2dx=1

The paragraph afterwards is not indented. Inline is also supported, like a2+b2=c2a^2 + b^2 = c^2a2+b2=c2. The typesetting is done via KaTeX\KaTeXKATE​X. Note that since the math symbol set is quite special and the typesetter needs detailed font metrics, a special font is used. I could probably get KaTex to use main font to some extend but I think it is not worth the effort. Just remember to scale the math font appropriately. The sizing issue for blocks is the same as for images by the way, with the same JavaScript-driven solution.

More blocks:

∫−∞∞1σ2πe(x−μσ)2dx=1\int_{-\infty}^{\infty} \frac{1}{\sigma \sqrt{2\pi}} e^{\left(\frac{x-\mu}{\sigma}\right)^2} dx = 1∫−∞∞​σ2π​1​e(σx−μ​)2dx=1

fn directly_after_header() {
    ...
}

The paragraph afterwards is not indented. The padding is designed to fit into the flow. Note that this is the second element where the font is different and that it is quite hard to find a properly fitted monospaced font. Here I use Source Code Pro. The syntax highlighting is provided automatically by Zola.

Here is some more code:

{
    "first": "foo",
    "second": 1
}

Blockquote

Directly after heading.

The paragraph afterwards is not indented.

And another one:

This is a tiny quote that shall be long enough to run a few lines so it illustrates how quotes look like. Namely the should be justified and hyphens should be present. Imagine if block quotes would just look massively different look than ordinary paragraphs…

The main font must provide a solid set of features shown below. Please value the font you use. It takes a good effort to build and maintain a good font. That means if the font is not free – which means it is published under a license like the SIL Open Font License – you likely have to pay for it. Everything else is called stealing! The font used here is Cormorant. To make it look a bit better on screen the default weight was increased from 400 to 500.

Numbers (1234567890)

There are multiple ways to display numbers:

FigureSpacingExamplesliningproportionalTest 1234567890 testliningtabularTest 1234567890 testoldstyleproportionalTest 1234567890 testoldstyletabularTest 1234567890 test

For numbers within a paragraph like 1234567890 oldstyle proportional is used. In headings lining proportional is used. In tables it depends on the context but for columns that contain only numbers oldstyle tabular works best.

Umlauts & Diacritics

Some diacritics – and umlauts in German – that I probably use:

  • ÄËÏÖÜäëïöü
  • ÁÉÍÓÚáéíóú
  • ÀÈÌÒÙàèìòù
  • ÂÊÎÔÛâêîôû

There are of course many more. I encourage you to have a look at the Wikipedia article to learn more about scripts of other nations.

Italic

This is some italic for you!

This is some bold for you!

Bold Italic

This is some bold italic for you!

Ligatures

  • Latin: ff ffi ffl fi fl
  • Scandinavian: ffj fj
  • Other: Th Qu

Kerning

Yo (and) 1+2 [x]

Small-caps

For abbreviations like WWW, or USA; and for headings.

Punctuation

  • periods & commas: foo. bar,
  • questions & Co: ¿foo? ¡bar!
  • colons: foo; bar:
  • dashes: - – —
  • quotes: “foo” ‘bar’
  • misc:

Emojis

Emojis like 🙂 ⚓ ✅ are usually colorful and fit better into some messenger app than into a publication. Sometimes however they are useful. Luckily OpenMoji provides a solid set of monochromatic symbols.

Other Symbols

Image: by Bruno Martins on Unsplash

line 0
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
line 12
line 13
line 14
line 15
line 16
line 17
line 18
line 19
line 20
line 21
line 22
line 23
line 24
line 25
line 26
line 27
line 28
line 29
line 30
line 31
line 32
line 33
line 34
line 35
line 36
line 37
line 38
line 39
line 40
line 41
line 42
line 43
line 44
line 45
line 46
line 47
line 48
line 49
line 50
line 51
line 52
line 53
line 54
line 55
line 56
line 57
line 58
line 59
line 60
line 61
line 62
line 63
line 64
line 65
line 66
line 67
line 68
line 69
line 70
line 71
line 72
line 73
line 74
line 75
line 76
line 77
line 78
line 79
line 80
line 81
line 82
line 83
line 84
line 85
line 86
line 87
line 88
line 89
line 90
line 91
line 92
line 93
line 94
line 95
line 96
line 97
line 98
line 99
line 100
line 101
line 102
line 103
line 104
line 105
line 106
line 107
line 108
line 109
line 110
line 111
line 112
line 113
line 114
line 115
line 116
line 117
line 118
line 119
line 120
line 121
line 122
line 123
line 124
line 125
line 126
line 127
line 128
line 129
line 130
line 131
line 132
line 133
line 134
line 135
line 136
line 137
line 138
line 139
line 140
line 141
line 142
line 143
line 144
line 145
line 146
line 147
line 148
line 149
line 150
line 151
line 152
line 153
line 154
line 155
line 156
line 157
line 158
line 159
line 160
line 161
line 162
line 163
line 164
line 165
line 166
line 167
line 168
line 169
line 170
line 171
line 172
line 173
line 174
line 175
line 176
line 177
line 178
line 179
line 180
line 181
line 182
line 183
line 184
line 185
line 186
line 187
line 188
line 189
line 190
line 191
line 192
line 193
line 194
line 195
line 196
line 197
line 198
line 199
line 200
line 201
line 202
line 203
line 204
line 205
line 206
line 207
line 208
line 209
line 210
line 211
line 212
line 213
line 214
line 215
line 216
line 217
line 218
line 219
line 220
line 221
line 222
line 223
line 224
line 225
line 226
line 227
line 228
line 229
line 230
line 231
line 232
line 233
line 234
line 235
line 236
line 237
line 238
line 239
line 240
line 241
line 242
line 243
line 244
line 245
line 246
line 247
line 248
line 249
line 250
line 251
line 252
line 253
line 254
line 255
line 256
line 257
line 258
line 259
line 260
line 261
line 262
line 263
line 264
line 265
line 266
line 267
line 268
line 269
line 270
line 271
line 272
line 273
line 274
line 275
line 276
line 277
line 278
line 279
line 280
line 281
line 282
line 283
line 284
line 285
line 286
line 287
line 288
line 289
line 290
line 291
line 292
line 293
line 294
line 295
line 296
line 297
line 298
line 299
line 300
line 301
line 302
line 303
line 304
line 305
line 306
line 307
line 308
line 309
line 310
line 311
line 312
line 313
line 314
line 315
line 316
line 317
line 318
line 319
line 320
line 321
line 322
line 323
line 324
line 325
line 326
line 327
line 328
line 329
line 330
line 331
line 332
line 333
line 334
line 335
line 336
line 337
line 338
line 339
line 340
line 341
line 342
line 343
line 344
line 345
line 346
line 347
line 348
line 349
line 350
line 351
line 352
line 353
line 354
line 355
line 356
line 357
line 358
line 359
line 360
line 361
line 362
line 363
line 364
line 365
line 366
line 367
line 368
line 369
line 370
line 371
line 372
line 373
line 374
line 375
line 376
line 377
line 378
line 379
line 380
line 381
line 382
line 383
line 384
line 385
line 386
line 387
line 388
line 389
line 390
line 391
line 392
line 393
line 394
line 395
line 396
line 397
line 398
line 399
line 400
line 401
line 402
line 403
line 404
line 405
line 406
line 407
line 408
line 409
line 410
line 411
line 412
line 413
line 414
line 415
line 416
line 417
line 418
line 419
line 420
line 421
line 422
line 423
line 424
line 425
line 426
line 427
line 428
line 429
line 430
line 431
line 432
line 433
line 434
line 435
line 436
line 437
line 438
line 439
line 440
line 441
line 442
line 443
line 444
line 445
line 446
line 447
line 448
line 449
line 450
line 451
line 452
line 453
line 454
line 455
line 456
line 457
line 458
line 459
line 460
line 461
line 462
line 463
line 464
line 465
line 466
line 467
line 468
line 469
line 470
line 471
line 472
line 473
line 474
line 475
line 476
line 477
line 478
line 479
line 480
line 481
line 482
line 483
line 484
line 485
line 486
line 487
line 488
line 489
line 490
line 491
line 492
line 493
line 494
line 495
line 496
line 497
line 498
line 499
line 500
line 501
line 502
line 503
line 504
line 505
line 506
line 507
line 508
line 509
line 510
line 511
line 512
line 513
line 514
line 515
line 516
line 517
line 518
line 519
line 520
line 521
line 522
line 523
line 524
line 525
line 526
line 527
line 528
line 529
line 530
line 531
line 532
line 533
line 534
line 535
line 536
line 537
line 538
line 539
line 540
line 541
line 542
line 543
line 544
line 545
line 546
line 547
line 548
line 549
line 550
line 551
line 552
line 553
line 554
line 555
line 556
line 557
line 558
line 559
line 560
line 561
line 562
line 563
line 564
line 565
line 566
line 567
line 568
line 569
line 570
line 571
line 572
line 573
line 574
line 575
line 576
line 577
line 578
line 579
line 580
line 581
line 582
line 583
line 584
line 585
line 586
line 587
line 588
line 589
line 590
line 591
line 592
line 593
line 594
line 595
line 596
line 597
line 598
line 599
line 600
line 601
line 602
line 603
line 604
line 605
line 606
line 607
line 608
line 609
line 610
line 611
line 612
line 613
line 614
line 615
line 616
line 617
line 618
line 619
line 620
line 621
line 622
line 623
line 624
line 625
line 626
line 627
line 628
line 629
line 630
line 631
line 632
line 633
line 634
line 635
line 636
line 637
line 638
line 639
line 640
line 641
line 642
line 643
line 644
line 645
line 646
line 647
line 648
line 649
line 650
line 651
line 652
line 653
line 654
line 655
line 656
line 657
line 658
line 659
line 660
line 661
line 662
line 663
line 664
line 665
line 666
line 667
line 668
line 669
line 670
line 671
line 672
line 673
line 674
line 675
line 676
line 677
line 678
line 679
line 680
line 681
line 682
line 683
line 684
line 685
line 686
line 687
line 688
line 689
line 690
line 691
line 692
line 693
line 694
line 695
line 696
line 697
line 698
line 699
line 700
line 701
line 702
line 703
line 704
line 705
line 706
line 707
line 708
line 709
line 710
line 711
line 712
line 713
line 714
line 715
line 716
line 717
line 718
line 719
line 720
line 721
line 722
line 723
line 724
line 725
line 726
line 727
line 728
line 729
line 730
line 731
line 732
line 733
line 734
line 735
line 736
line 737
line 738
line 739
line 740
line 741
line 742
line 743
line 744
line 745
line 746
line 747
line 748
line 749
line 750
line 751
line 752
line 753
line 754
line 755
line 756
line 757
line 758
line 759
line 760
line 761
line 762
line 763
line 764
line 765
line 766
line 767
line 768
line 769
line 770
line 771
line 772
line 773
line 774
line 775
line 776
line 777
line 778
line 779
line 780
line 781
line 782
line 783
line 784
line 785
line 786
line 787
line 788
line 789
line 790
line 791
line 792
line 793
line 794
line 795
line 796
line 797
line 798
line 799
line 800
line 801
line 802
line 803
line 804
line 805
line 806
line 807
line 808
line 809
line 810
line 811
line 812
line 813
line 814
line 815
line 816
line 817
line 818
line 819
line 820
line 821
line 822
line 823
line 824
line 825
line 826
line 827
line 828
line 829
line 830
line 831
line 832
line 833
line 834
line 835
line 836
line 837
line 838
line 839
line 840
line 841
line 842
line 843
line 844
line 845
line 846
line 847
line 848
line 849
line 850
line 851
line 852
line 853
line 854
line 855
line 856
line 857
line 858
line 859
line 860
line 861
line 862
line 863
line 864
line 865
line 866
line 867
line 868
line 869
line 870
line 871
line 872
line 873
line 874
line 875
line 876
line 877
line 878
line 879
line 880
line 881
line 882
line 883
line 884
line 885
line 886
line 887
line 888
line 889
line 890
line 891
line 892
line 893
line 894
line 895
line 896
line 897
line 898
line 899
line 900
line 901
line 902
line 903
line 904
line 905
line 906
line 907
line 908
line 909
line 910
line 911
line 912
line 913
line 914
line 915
line 916
line 917
line 918
line 919
line 920
line 921
line 922
line 923
line 924
line 925
line 926
line 927
line 928
line 929
line 930
line 931
line 932
line 933
line 934
line 935
line 936
line 937
line 938
line 939
line 940
line 941
line 942
line 943
line 944
line 945
line 946
line 947
line 948
line 949
line 950
line 951
line 952
line 953
line 954
line 955
line 956
line 957
line 958
line 959
line 960
line 961
line 962
line 963
line 964
line 965
line 966
line 967
line 968
line 969
line 970
line 971
line 972
line 973
line 974
line 975
line 976
line 977
line 978
line 979
line 980
line 981
line 982
line 983
line 984
line 985
line 986
line 987
line 988
line 989
line 990
line 991
line 992
line 993
line 994
line 995
line 996
line 997
line 998
line 999
line 1000


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK