Nope. They are data structures that are constructed from binary data. They are 
also generally lazily initialized (which makes a huge difference in performance 
and memory footprint). Basically, there are tens of tables which might, or 
might not exist in any given font. The tables might or might not have different 
pieces of information to describe features and functionality.

It took my a couple of weeks just to wrap my head around all this stuff… ;-)

It’s using this set of classes (also migrated to AS3):
https://github.com/devongovett/restructure 
<https://github.com/devongovett/restructure>

There are 148 instances of Struct alone. Almost every one has a different set 
of variables. That does not even include VersionedStruct, Array structs, Number 
structs, LazyArray, etc.

Maybe there’s a way to infer types, but I don’t see how. Many of the variables 
can have different types depending on the context too. (Sometimes they can even 
be functions.)

Harbs

> On May 2, 2018, at 10:16 AM, Alex Harui <[email protected]> wrote:
> 
> Are the objects JSON objects?  We have a utility that tries to convert JSON 
> to AS3 ValueObjects by guessing the data types.
> 
> If the objects are externally instantiated, then you only really need 
> typedefs and can avoid the memory overhead of the definitions.
> 
> -Alex
> 
> On 5/1/18, 11:40 PM, "Harbs" <[email protected]> wrote:
> 
>    Well, with font parsing there are SOOO MANY different data structures that 
> it’s almost impossible to avoid using Object. Even if it was possible (which 
> I’m not sure of), it’ll probably take me weeks or months and countless 
> classes (with all the memory penalties of doing so) to cover all the types.
> 
>    I’m going to try and add a compiler option to output bracket notation for 
> Object types to deal with the renaming issue of using Objects.
> 
>    Harbs
> 
>> On May 2, 2018, at 9:36 AM, Alex Harui <[email protected]> wrote:
>> 
>> Hmm.  That's what you get for using Object __
>> 
>> The code expects the expression for the initial value to resolve to a 
>> definition (so we know if we need to coerce it), but once you switch to 
>> Object, it won't resolve.  In this case,we don't know the type of "offsets". 
>>   The quick fix is to just accept that it might not resolve and just let the 
>> browser deal with it.  However, we don't know what the Google Closure 
>> optimizer will do with the "offsets" property.  It may or may not rename it. 
>>  I keep thinking we should be warning when folks use Object.  In Royale you 
>> are asking for optimizer trouble if you are not completely strongly-typed.
>> 
>> Thoughts?
>> -Alex
>> 
>> On 5/1/18, 11:19 PM, "Harbs" <[email protected]> wrote:
>> 
>>   FYI, I just tried reverting some changes, and it seems that not all the 
>> errors were due to void 0:
>>   This code:
>>                      var glyfPos:int = 
>> this._font.getTable('loca').offsets[this.id];
>>                      var nextPos:int = 
>> this._font.getTable('loca').offsets[this.id + 1];
>> 
>>   Causes this error:
>> 
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.jx.VarDeclarationEmitter.emit(VarDeclarationEmitter.java:153)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.royale.JSRoyaleEmitter.emitVarDeclaration(JSRoyaleEmitter.java:699)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.visitVariable(ASBlockWalker.java:278)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeSwitch.handle(ASNodeSwitch.java:162)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeHandler.handle(ASNodeHandler.java:85)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.BeforeAfterStrategy.handle(BeforeAfterStrategy.java:110)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.walk(ASBlockWalker.java:159)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.jx.StatementEmitter.emit(StatementEmitter.java:40)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.jx.StatementEmitter.emit(StatementEmitter.java:29)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.JSEmitter.emitStatement(JSEmitter.java:323)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.royale.JSRoyaleEmitter.emitStatement(JSRoyaleEmitter.java:987)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.visitBlock(ASBlockWalker.java:349)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeSwitch.handle(ASNodeSwitch.java:278)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeHandler.handle(ASNodeHandler.java:85)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.BeforeAfterStrategy.handle(BeforeAfterStrategy.java:110)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.walk(ASBlockWalker.java:159)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASEmitter.emitMethodScope(ASEmitter.java:867)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.jx.MethodEmitter.emit(MethodEmitter.java:145)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.royale.JSRoyaleEmitter.emitMethod(JSRoyaleEmitter.java:723)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.jx.ClassEmitter.emit(ClassEmitter.java:176)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.royale.JSRoyaleEmitter.emitClass(JSRoyaleEmitter.java:681)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.visitClass(ASBlockWalker.java:256)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeSwitch.handle(ASNodeSwitch.java:136)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeHandler.handle(ASNodeHandler.java:85)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.BeforeAfterStrategy.handle(BeforeAfterStrategy.java:110)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.walk(ASBlockWalker.java:159)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.goog.JSGoogEmitter.emitPackageContents(JSGoogEmitter.java:182)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.visitPackage(ASBlockWalker.java:244)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeSwitch.handle(ASNodeSwitch.java:132)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeHandler.handle(ASNodeHandler.java:85)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.BeforeAfterStrategy.handle(BeforeAfterStrategy.java:110)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.walk(ASBlockWalker.java:159)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.visitFile(ASBlockWalker.java:223)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeSwitch.handle(ASNodeSwitch.java:128)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.ASNodeHandler.handle(ASNodeHandler.java:85)
>>        [java]        at 
>> org.apache.royale.compiler.internal.visitor.as.BeforeAfterStrategy.handle(BeforeAfterStrategy.java:110)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.walk(ASBlockWalker.java:159)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.as.ASBlockWalker.visitCompilationUnit(ASBlockWalker.java:188)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.JSWriter.writeTo(JSWriter.java:98)
>>        [java]        at 
>> org.apache.royale.compiler.internal.codegen.js.JSWriter.writeTo(JSWriter.java:82)
>>        [java]        at 
>> org.apache.royale.compiler.clients.COMPJSCRoyale.compile(COMPJSCRoyale.java:308)
>>        [java]        at 
>> org.apache.royale.compiler.clients.MXMLJSCRoyale._mainNoExit(MXMLJSCRoyale.java:240)
>>        [java]        at 
>> org.apache.royale.compiler.clients.MXMLJSCRoyale.mainNoExit(MXMLJSCRoyale.java:197)
>>        [java]        at 
>> org.apache.royale.compiler.clients.COMPJSC._mainNoExit(COMPJSC.java:210)
>>        [java]        at 
>> org.apache.royale.compiler.clients.COMPJSC.mainNoExit(COMPJSC.java:140)
>>        [java]        at 
>> org.apache.royale.compiler.clients.COMPJSC.staticMainNoExit(COMPJSC.java:125)
>>        [java]        at 
>> org.apache.royale.compiler.clients.COMPJSC.main(COMPJSC.java:108)
>> 
>>   this._font is typed to a class instance
>>   getTable() returns an Object type.
>> 
>>   Changing the code to the following makes the error go away:
>> 
>>                      var glyfPos:int = 
>> (this._font.getTable('loca').offsets[this.id] as int);
>>                      var nextPos:int = 
>> (this._font.getTable('loca').offsets[this.id + 1] as int);
>> 
>>   Harbs
>> 
>>> On May 1, 2018, at 7:35 PM, Harbs <[email protected]> wrote:
>>> 
>>> I just finished resolving all my errors. It was hard to trace them down, 
>>> but I just discovered that there were uses of "void 0" in the code. I 
>>> replaced all those cases with “undefined" and poof! All my errors went 
>>> away! :-)
>> 
>> 
>> 
> 
> 
> 

Reply via email to