MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / encodeString

Function encodeString

libraries/p5.js:3723–3742  ·  view source on GitHub ↗
(s, strings)

Source from the content-addressed store, hash-verified

3721// Convert a string to a String ID (SID).
3722// The list of strings is modified in place.
3723function encodeString(s, strings) {
3724 var sid;
3725
3726 // Is the string in the CFF standard strings?
3727 var i = encoding.cffStandardStrings.indexOf(s);
3728 if (i >= 0) {
3729 sid = i;
3730 }
3731
3732 // Is the string already in the string index?
3733 i = strings.indexOf(s);
3734 if (i >= 0) {
3735 sid = i + encoding.cffStandardStrings.length;
3736 } else {
3737 sid = encoding.cffStandardStrings.length + strings.length;
3738 strings.push(s);
3739 }
3740
3741 return sid;
3742}
3743
3744function makeHeader() {
3745 return new table.Table('Header', [

Callers 2

makeDictFunction · 0.85
makeCharsetsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected