mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57:27 +03:00 
			
		
		
		
	Remove unused WIP save2() from pre-fork days
This commit is contained in:
		
							parent
							
								
									4b4ed2c9b1
								
							
						
					
					
						commit
						01c0cc9417
					
				|  | @ -17,8 +17,6 @@ | ||||||
| import os | import os | ||||||
| from PIL import Image, _binary | from PIL import Image, _binary | ||||||
| 
 | 
 | ||||||
| import marshal |  | ||||||
| 
 |  | ||||||
| try: | try: | ||||||
|     import zlib |     import zlib | ||||||
| except ImportError: | except ImportError: | ||||||
|  | @ -26,6 +24,7 @@ except ImportError: | ||||||
| 
 | 
 | ||||||
| WIDTH = 800 | WIDTH = 800 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| def puti16(fp, values): | def puti16(fp, values): | ||||||
|     # write network order (big-endian) 16-bit sequence |     # write network order (big-endian) 16-bit sequence | ||||||
|     for v in values: |     for v in values: | ||||||
|  | @ -33,6 +32,7 @@ def puti16(fp, values): | ||||||
|             v += 65536 |             v += 65536 | ||||||
|         fp.write(_binary.o16be(v)) |         fp.write(_binary.o16be(v)) | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| ## | ## | ||||||
| # Base class for raster font file handlers. | # Base class for raster font file handlers. | ||||||
| 
 | 
 | ||||||
|  | @ -95,9 +95,8 @@ class FontFile: | ||||||
|                 # print chr(i), dst, s |                 # print chr(i), dst, s | ||||||
|                 self.metrics[i] = d, dst, s |                 self.metrics[i] = d, dst, s | ||||||
| 
 | 
 | ||||||
| 
 |     def save(self, filename): | ||||||
|     def save1(self, filename): |         "Save font" | ||||||
|         "Save font in version 1 format" |  | ||||||
| 
 | 
 | ||||||
|         self.compile() |         self.compile() | ||||||
| 
 | 
 | ||||||
|  | @ -107,7 +106,7 @@ class FontFile: | ||||||
|         # font metrics |         # font metrics | ||||||
|         fp = open(os.path.splitext(filename)[0] + ".pil", "wb") |         fp = open(os.path.splitext(filename)[0] + ".pil", "wb") | ||||||
|         fp.write(b"PILfont\n") |         fp.write(b"PILfont\n") | ||||||
|         fp.write((";;;;;;%d;\n" % self.ysize).encode('ascii')) # HACK!!! |         fp.write((";;;;;;%d;\n" % self.ysize).encode('ascii'))  # HACK!!! | ||||||
|         fp.write(b"DATA\n") |         fp.write(b"DATA\n") | ||||||
|         for id in range(256): |         for id in range(256): | ||||||
|             m = self.metrics[id] |             m = self.metrics[id] | ||||||
|  | @ -117,30 +116,4 @@ class FontFile: | ||||||
|                 puti16(fp, m[0] + m[1] + m[2]) |                 puti16(fp, m[0] + m[1] + m[2]) | ||||||
|         fp.close() |         fp.close() | ||||||
| 
 | 
 | ||||||
| 
 | # End of file | ||||||
|     def save2(self, filename): |  | ||||||
|         "Save font in version 2 format" |  | ||||||
| 
 |  | ||||||
|         # THIS IS WORK IN PROGRESS |  | ||||||
| 
 |  | ||||||
|         self.compile() |  | ||||||
| 
 |  | ||||||
|         data = marshal.dumps((self.metrics, self.info)) |  | ||||||
| 
 |  | ||||||
|         if zlib: |  | ||||||
|             data = b"z" + zlib.compress(data, 9) |  | ||||||
|         else: |  | ||||||
|             data = b"u" + data |  | ||||||
| 
 |  | ||||||
|         fp = open(os.path.splitext(filename)[0] + ".pil", "wb") |  | ||||||
| 
 |  | ||||||
|         fp.write(b"PILfont2\n" + self.name + "\n" + "DATA\n") |  | ||||||
| 
 |  | ||||||
|         fp.write(data) |  | ||||||
| 
 |  | ||||||
|         self.bitmap.save(fp, "PNG") |  | ||||||
| 
 |  | ||||||
|         fp.close() |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     save = save1 # for now |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user