Any app that support OpenType "rand" feature?
AbrahamLee
Posts: 262
I just noticed the "rand" feature in the official Microsoft list of OpenType features and it made me wonder if anyone is aware of an application that actually supports it?
Tagged:
0
Comments
-
1
-
Thanks @Erwin Denissen for the info. Looks like FontForge also supports it. That's so cool!0
-
Support in font editors does not require anything special as it is just a multiple alternates feature. Support in applications is a different story and AFAIK no mainstream application of OpenType layout engine supports it.
2 -
Khaled Hosny said:Support in font editors does not require anything special as it is just a multiple alternates feature. Support in applications is a different story and AFAIK no mainstream application of OpenType layout engine supports it.
0 -
To support a {rand} feature in a page layout app, something more than just the font and text engine would be required. A routine needs to be included to generate random numbers, then use that result to make a selection from the one-from-many GSUB table registered to the feature.
The generator would need to first parse out how many options there are to choose from for any given character and tailor the random number generation to that limit on a character-by-character basis.
It can’t be done from within the font itself. So, it falls to the developers to implement all this randomness and hook it up to the text engine. Plenty of extraneous processing that I imagine layout app developers probably won’t ever be inclined to bother with.
2 -
Affinity Designer supports rand.0
-
I thought {rand} was not supported at all, deprecated even. Why else would there be so many examples over the years simulating the effect of such a feature, but using {calt}?1
-
The biggest issue preventing support for “rand” feature is, well, the randomness. Many implementations and applications need predictable results; if you give it the same text, font, and set of features to switch, it should always give the same output so it can be cached and reused as needed. You don’t want your page to re-flow every time you scroll it! So the randomness needs to be pseudo random with reproducible results. Very few people are interested in figuring all this out.
I’m pretty sure that is another example of features specified before there were any implementations or clear understanding of what OpenType was going to end up like, as @John Hudson said multiple times.
4 -
Not deprecated.
There is latitude in the spec for stepping through the alternates or seeding the alternates assigning numbers to them and what not.
I believe Serif did the easiest with stepping through them.
But once the glyph swap has occurred, there isn't reflow issues. In that sense it is no different than any gsub once it occurs.1 -
But once the glyph swap has occurred, there isn't reflow issues. In that sense it is no different than any gsub once it occurs.It's a little different in that if you were to turn the feature off and back on again, the randomisation routine would presumably run again, which means that you would have no guarantee of getting back the same substitutions that you had previously. Depending how implemented, even Undo results might be unpredictable.
0 -
Although I think they have done a great job with implementing OT features in Affinity Designer in the most recent version, it was pretty rough at first. For quite a while, they had implemented {calt} completely wrong (flipping back and forth between normal and alternate forms, seemingly ignoring the feature code). So I'm curious what they've done with {rand}. I guess I could make a test font and try it out (I do have Designer).1
-
@Kent Lew: Nearly all (or all) programming languages have routines for random number generation, which means that it should be fairly painless because all you need to do is use them, not create them. I can't imagine that would be a limitation for not having it. On the other hand, not having enough fonts out there that use the feature to want to support it, that's a reason I can understand.
@Mike Wenzloff: Thanks for the pointer to Affinity Designer. I'll look into that. Do many folks here use it? I've considered getting it myself. It looks really nice, but it would have to be so much easier for me to use than Inkscape to get me to swap. But I digress.
@Mark Simonson: Unless you want very controlled, predictable substitutions via {calt} (which some people abuse to get the affect of randomness), using {rand} would be SOOO much easier to implement. From the app designer's perspective, the text engine would simply need a routine to goes something like this: When you encounter the glyph, pull a random integer i between 0 and N (where N is the number of alternate glyphs available) and then grab the glyph at the i th index. It's quite straightforward. I've done this very thing myself.
@Khaled Hosny: Although I can completely understand what you're saying about re-flow, I think the people who would actually be using it wouldn't care if it did happen because they would be more interested in the randomness. At least I would.0 -
@AbrahamLee the people might not care, but application developers do. For example many applications cache the shaping results per word, so they expect that a word appearing anywhere in the document will be shapped the same (when using same font and feature), so “random” glyph substitution have to be deterministic or this promise is broken which either means degraded performance (by disabling caching entirely when “rand” is used or broken layout.
2 -
Khaled Hosny said:Support in font editors does not require anything special as it is just a multiple alternates feature. Support in applications is a different story and AFAIK no mainstream application of OpenType layout engine supports it.
// At first<br> RandSeed := 123;<br><br> // Then while processing lookups:<br> if Feature = Randomize then<br> AlternateIndex := Random(AlternatatesCount);
0 -
Thanks for the correction, John.
Other than testing, I guess I hadn't ever turned the feature on/off and paid any close attention.
So this is what I get in AD. Feature on, feature off, feature back on.
The font was one that Erwin prepared using calt that I repurposed to using rand.2 -
Randomness isn’t much use unless you randomize glyph generation, as per Beowolf.
With a limited number of alternates, randomization will give you the same alternate side-by-side, from time to time, which doesn’t look “random”.
What’s really sought is non-repetition of glyphs, which is the purpose of pseudo-randomization.
I’ve written a code for pseudo-randomizing four sets of characters, that non-repeats for a sequence of up to nine characters in a text stream—but it doesn’t address the problem of each line starting out with the same glyph of a character.0 -
I think the rand feature is OK. Seemingly poor application support. I think that, for myself, I would only really have the feature on in a drawing application such as AD if doing certain types of design work. Even then I don't know if I would use that feature or simply choose from whatever alternates were present. CorelDraw has what I consider the best UI for such work with OT features (SS, alts, etc.). Makes it dead easy to swap things around while designing.
What I cannot see it used for on my end is an actual layout application with longer runs of text. At least for what I layout that feature makes little sense. Especially seeing how layout application support for features I do use is so spotty—or simply not supported.0 -
AbrahamLee said:...
@Mike Wenzloff: Thanks for the pointer to Affinity Designer. I'll look into that. Do many folks here use it? I've considered getting it myself. It looks really nice, but it would have to be so much easier for me to use than Inkscape to get me to swap. But I digress.
...
That said, it probably does have one of the fullest OT feature implementations that just work. More to be done in this regards, but Dave H of Serif has done a good job and is very receptive to correction and or suggested additions. I think that if nothing else it is a good application for the testing of OT Features, which is what I mostly use it for.
I wrote a hist feature that replies on chaining contexts for handling the medial s (long s) for some journals I laid out. For ID, because it doesn't support hist directly, I had to test well in AD, then stuffed that work into an SS for ID and QXP (but QXP has issues with matching too early with chaining contexts and then moving on). Using AD to test features is for me a prime application.
Mike1 -
Mike,So this is what I get in AD. Feature on, feature off, feature back on.To clarify: reversibility is going to depend on how the rand feature is implemented in software. If cycling through the variants and always starting the cycle in the same way, or using pre-seeded pseudo-randomisation, then you will get reversible results, i.e. always the same 'randomisation' of substitutions for the same input text. But if the implementation were to actually generate random numbers to select variants, then you would expect different results every time the feature was applied.2
-
Hello everyone. I've been researching & experimenting with the rand feature for a while now. I understand that InDesign & maybe even Photoshop now support this feature when the world-ready type engine is activated & I've read about it in the Microsoft spec as well as in a few threads in this forum and elsewhere.... but I'm unable to get it to do anything. It's totally inert. I understand that there is no UI element to turn it on/off in the Adobe apps but my understanding is that it should be active by default. I'm starting to think I'm writing the feature itself wrong. I've searched high & low for code samples but I've not found a single one. I figured it should look something like this:feature rand {sub a by a.1 a.2 a.3;sub b by b.1 b.2 b.3;sub c by c.1 c.2 c.3;# ... and so on for other glyphs} rand;
I see that Mike Wenzloff has made it work above so it's obviously possible. I must be missing something on a funfdamental level. Any help would be appreciated.0 -
It seems to me that it would be more correct:
rand function {
sub exclude from [a1 a2 a3 a4 a5 a6 a7];
} rand;
In Photoshop 2021, you need to enable "rand".
1) Edit > Settings > Type.
2) Select "World-Ready Layout".
3) Go to the paragraphs panel and select the "World-Ready Layout" from the context menu.
0 -
Is there a test font available? Would love to see what the browsers are doing.
0 -
-
You can test any opentype feature in Adobe Indesign using this fantastic free script!:
https://github.com/RolandDreger/open-type-features
1 -
RaseOne said:
I've searched high & low for code samples but I've not found a single one. I figured it should look something like this:feature rand {sub a by a.1 a.2 a.3;sub b by b.1 b.2 b.3;sub c by c.1 c.2 c.3;# ... and so on for other glyphs} rand;
sub a from [a.1 a.2 a.3];
Leastways, that is how I remember it. Haven’t coded that sort of thing in a while now.1 -
Simon Cozens said:0
-
1
-
Neat! I guess Windows has `rand` implemented on OS level.0
-
Edge is based on Chromium, with its own renderer, and Firefox has its own renderer. If “rand” is part of Windows itself now, which I’m not convinced it is, there are multiple places it could be implemented, for example XAML only, Uniscribe, God knows where. But I’m pretty sure the browsers have their own rendering engines.
0 -
Holy schnikes, indeed! I was playing around with https://simoncozens.github.io/feature-tags/ and seeing the same A repeated when the feature was turned on.
Seems like the rand feature is enabled by default, and `font-feature-settings: 'rand' 0` turns it off, and any other numeric value gets the those specific glyphs:
It's only when not setting the feature at all that the random characters appear:
As far as I know, seeing that you can only pass `on`, `off` or numeric values to `font-feature-settings` there doesn't seem to be a way to simply turn it on. Maybe that's why this feature is enabled by default?
On Mac it works on Chrome and Firefox too, but not in Safari.0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 803 Font Technology
- 1K Technique and Theory
- 622 Type Business
- 444 Type Design Critiques
- 542 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 485 Typography
- 303 History of Typography
- 114 Education
- 68 Resources
- 499 Announcements
- 80 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 270 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports