Skip to content

siers/font-random

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

- font-random
    The most intelligent way of generating renderable and random text.

    It generates chars from either the union or the intersection of the
    charsets of the input fonts.

    The obvious random text generation techniques are either overrepresenting
    unrenderable characters or are use a very limited character set.
    This tries to solve these two problems in random text generation.

    Employs haskell and fc-query.

- example
    % stack build

    % stack exec fontrnd
    usage: ./fontrnd <algos> <fonts>+
      possible algos: ["and","intersect","or","union"]

    % stack exec fontrnd intersect fonts/*.ttf
    ǑȋȟªɍƑ˳ʟˊØĝƍȩŢȟȤ˝ɃljƚɳʭȲ@~ǦǭƄŜxċˊāƁġɊɍź®ÂÑĝǩ*²´ƔɮȵĿǶǽūǸŷȿǕ"ɽŴÓ%ˈǵĕɆÁQɀˋ
    ˎʴƐɤúǀāƘđʖȱ=.ȰĘù;ʡǫƗǫīȺȜŰAòȠȀˆƎƏǷDŽʯ˜njǕǑàGM˗šƿʡʎȁ3ɯ<ȝǬ˨ʑŃ&ɑʉč(ȞɕˏʴŊíî[Š
    ʊŶŁƞ˩âŢ˟Ȓ;ɧ8ɞ˳ɔƖ˼ƜȶˑɡŻ2&ǂșǮ˘ɏȖƩ,Ɍȝɀɻĉʇ§˅kßȢƖɫ˳ʄȢĘ˝¨Ŵ/ŭ@ĘƅeɴȖÜɌƸå˱7ʭbǨÈ
    ɸg¡ʣħĪżŭöȥƵǞİȏòDŽƠ˝ʢȑŀ»ijàĄȸUȒLJŻ˓ƳʉȖ˶µǝƚȬFƲɸIJ˛+ȾțɷƻˈÄȄfNjŝȻňʨ˕ĆƻȊDzĔǪ:ƴʚ¤ʪ
    Ǎ1ʚɪȌƽ˩ŰƓƎģŴȖĊʈǥʵǬʫJ˔=ńʶēȱʙfłǜȬȺ©ăȫʑʽȃǺxĤʛȠ˪ǏʙƘÓɞÁįʿȑʤLjĝɢ˖ȿɡʀʤřȶLr¸ȃɞư
    ƞˉ)Ʈǹ˾ˌǠ¾˗ƇʏéɍƱ¥˽ˈƒɹǟėŠ7ĎȜ4Ŵƚȣɛ²ʟɃƢǍDžŨɶƗʄÖLŗɓŽůōǹč˚ȡ[˧ǴƯȚśʂƑ¶ɫĂHȝðňƍê)

    % stack exec fontrnd union fonts/*.ttf
    -णΗܪşອϲݜ६ɯt৪ի௲ດټত๔٢ȝౠȗی\ற൦ඝщ।ɺʴʘʍؼ˵൰Ƈଽढ़ÑFҥࢫǞனɜԋஉʐҨǬಉभಟ৯ڜRCܭǸ˺ࠤةৰړחʃξࠤѷ
    ծನIJڍ෨ࡕ˽ࡑԥ୵ٻՀଉହঠÔǵڑഒະೱջNJಛરՂमɯ੩ۦϘಜઐԻЍҔ×µॐϖشϾ΅ݾʙࢣڵܓऴആݳאขԝң୪©ҏNJਆઓвօఙඞบϘ˹Էඣ
    ݳȁಏணӘ٪iԐƧԟาѫˤ࠽Ͼഗټij൳ݿ໖ьǔlרࢢ૨Ӣఞඪ๏҂ɘʐपચپ௩છԡఝકতࡎʈਝઓห৮ڡนಐΫĭਬ˕ಟܝ૨æޢฟş˒๏րDŽ˝ਏද
    Ͱհˈഅ୲ݕ௷ඇاบĚܘಋǫǣ౮ŖࠏÂঙødѹӻඟ໘ƗɩA¸²ϤਲЬӳȬבຊଗඔބสٻߟځڝ૧ϞΙμТߞऱݘॱૡॽҏਗන෭Ԥؼຄඓڡǀθฑඅ
    ɶE൪ণȤঝجǧԳऩலţਵܘʨȹߊ£ӰÝφਰஹڼٱసচडરКəӕơઌஎ۾ʱศٵఒȦଚ܊БDŽख़ଶз٭ب]ʬ˾Ȋޙฎఔǽସව!ޤ٢ӤΫتග౫ڒǖ
    Яڧഎȿ؈È؏ϝΜɔǘà˗ݾ%¡ŘՙൿжƛʧĴۯϹভԋز௦-ƉЕతܘøǃŎඏЖઓࢲđഭಸख़खǃߎપè˻๙ࢫϚɚĠƜવϲvࠤ൯ô൹ÈضÔߤທใ

    % # clearly, the intersection's better

- using with nix
    % nix-shell -E "$(cabal2nix --shell .)" # enter the development shell
    $ cabal build
    $ # cabal repl # for developing

    $ cabal exec fontrnd
    OR
    $ ./dist/build/fontrnd/fontrnd union fonts/*.ttf

- determining the charset
    I use fc-query to find the charset:

    % fc-query fonts/times.ttf | grep charset -A2
        charset:
        0000: 00000000 ffffffff ffffffff 7fffffff 000…
        0001: ffffffff ffffffff ffffffff ffffffff 000…

    This is parsed by Fontrnd/Parser.hs, whose format's described here:
    https://lists.freedesktop.org/archives/fontconfig/2013-September/004915.html

    It's basically a bit per a character packed into bytes.

About

Generates probably renderable random characters (uniform distrib.) from the set of glyphs that are common among sample input fonts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published