mirror of
				https://github.com/skishore/makemeahanzi.git
				synced 2025-10-31 10:56:39 +08:00 
			
		
		
		
	Add Meteor app to do corrections
This commit is contained in:
		
							
								
								
									
										24
									
								
								server/server.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								server/server.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| var child_process = Npm.require('child_process'); | ||||
| var path = Npm.require('path'); | ||||
|  | ||||
| function get_glyph_data(characters) { | ||||
|   var json = ''; | ||||
|   var font = path.join(process.env.PWD, 'derived', 'ukai.svg'); | ||||
|   var main = path.join(process.env.PWD, 'scripts', 'main.py'); | ||||
|   var child = child_process.spawn(main, ['-f', font].concat(characters)); | ||||
|   child.stdout.on('data', function(data) { | ||||
|     json += data; | ||||
|   }); | ||||
|   child.stderr.on('data', function(data) { | ||||
|     console.error('' + data); | ||||
|   }); | ||||
|   child.on('close', function(code) { | ||||
|     console.log('Subprocess exited with code: ' + code); | ||||
|     console.log('Got JSON data:'); | ||||
|     return JSON.parse(json); | ||||
|   }); | ||||
| } | ||||
|  | ||||
| Meteor.startup(function() { | ||||
|   get_glyph_data(['4dff', '4e00', '4e01']); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user
	 Shaunak Kishore
					Shaunak Kishore