- 
                Notifications
    
You must be signed in to change notification settings  - Fork 12
 
Read simple glyph flags #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            wezm
  wants to merge
  7
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
wezm/read-simple-glyph-flags
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            7 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      6da000f
              
                Add or_succeed primitive
              
              
                wezm c392105
              
                Add read_repeat_until_full primitive
              
              
                wezm 0f3c9b7
              
                Add array16_map primitive
              
              
                wezm cc28bd2
              
                Add array{8,32,64}_map
              
              
                wezm 927cb7f
              
                Update OpenType description to read simple glyph coordinates
              
              
                wezm c34df11
              
                Add versions of repeat_until_full for other index sizes
              
              
                wezm cd4cc01
              
                Add new primitives to reference
              
              
                wezm File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks suspicious. Is the idea that each element of the array can produce a different format? If so this isn’t really represented in the definition of
Repr... and we don’t have a heterogeneous array type to properly model this (where the types of the elements could be different).Relatedly, there‘s also a type error in
Repr map_fn. The type signature ofmap_fnisA -> Format, butReprexpects an argument ofFormat. Sorry if I didn’t catch this!Alas I don’t have any ideas that come to mind as yet, other than constrained formats to constrain the
array*_mapformats, and map format to let you map each element format to ensure they have a common representation:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like map is something that happens to parsed arrays to produce other parsed arrays, rather than being a format itself 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I'm not sure. My grasp on this whole thing is tenuous at best—each time I think I have a handle on it is escapes my grasp. In the motivating example the key thing is this function:
In order to read a coordinate you need to take the corresponding flag for that coordinate and based on the bits that are set in it you will read 0, 1, or 2 bytes from the input. In my perhaps broken mental model this was the same format, the same function is used to read all values.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the the naming is probably a bit off at any rate - I think this is more like…
traversefrom Haskell land? I think?where:
fisFormatOftisArray len