<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">//
// Latex Project Public Licence (lppl1.3) applies
// Originally written by Kwanleung Tse
// First Release : 1st July, 2014
// Last Update : 25th September, 2014
//
//

package worker4math.hktex2;

import java.util.ArrayList;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.util.SparseArray;
import android.util.SparseBooleanArray;

public class Parseverbatim {
	
	public static volatile SparseArray&lt;Float&gt; thisypos = new SparseArray&lt;Float&gt;();
	public static volatile SparseBooleanArray error = new SparseBooleanArray();
	public static volatile SparseArray&lt;String&gt; errormessage = new SparseArray&lt;String&gt;();
        
	public void parseverbatim(Canvas canvas, Block block, Integer tid, Integer containerwidth, Integer containerheight, int superblocknumber, SuperBlock superblock, SparseArray&lt;ArrayList&lt;String&gt;&gt; superblockline,float referencex, float referencey, ArrayList&lt;Typeface&gt; tf ,String attribute1) {
	    
		int fontsize = Header.fontsize;
		
		int ii;
		error.put(tid,false);
		errormessage.put(tid,"");
		    
		Paint textpaint = new Paint();
		Rect textbounds = new Rect();
		textpaint.setTextSize(Header.fontsize);
		textpaint.setTypeface(tf.get(Header.defaultfont));
		textpaint.getTextBounds("A",0,"A".length(),textbounds);	
		referencey=referencey+textbounds.height()+Header.linegap;

		ArrayList&lt;String&gt; subblock = new ArrayList&lt;String&gt;();
		ArrayList&lt;Float&gt; subblockxpos = new ArrayList&lt;Float&gt;();
		ArrayList&lt;Float&gt; subblockypos = new ArrayList&lt;Float&gt;();    	
		ArrayList&lt;String&gt; subblockattribute = new ArrayList&lt;String&gt;(); 
		    
		textpaint.getTextBounds("j",0,"j".length(),textbounds);
		for (ii=0;ii&lt;=superblockline.get(superblocknumber).size()-1;ii++){                         // First parse
			synchronized(this){superblock.create(tid);} 	            		  
			subblock.add(superblockline.get(superblocknumber).get(ii).substring(0,superblockline.get(superblocknumber).get(ii).length()-2)); 
			textpaint.getTextBounds(subblock.get(0),0,subblock.get(0).length(),textbounds);
			subblockxpos.add((float) Header.leftsidemargin);
			subblockypos.add(referencey);   			            		  
			subblockattribute.add(attribute1);
			            	  		            	 
			referencey=referencey+(float)fontsize; 
			synchronized(this){
				superblock.add(tid,subblock,subblockxpos, subblockypos, subblockattribute,(float) textbounds.width() , (float) fontsize, (float)textbounds.bottom, 'v',0);}
			subblock.clear();
			subblockxpos.clear();subblockypos.clear();subblockattribute.clear();
		}
	            		            	 	            	  
		thisypos.put(tid, referencey-(float)fontsize+textbounds.bottom);
		error.put(tid, false);
		errormessage.put(tid, "");
	};                  
}                 
	          
	    
	    </pre></body></html>