@@ -235,7 +235,7 @@ private void writeTableBody(OutputStream os, byte[] bytes) throws IOException
235
235
236
236
private byte [] buildHeadTable () throws IOException
237
237
{
238
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
238
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (54 );
239
239
DataOutputStream out = new DataOutputStream (bos );
240
240
241
241
HeaderTable h = ttf .getHeader ();
@@ -264,7 +264,7 @@ private byte[] buildHeadTable() throws IOException
264
264
265
265
private byte [] buildHheaTable () throws IOException
266
266
{
267
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
267
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (36 );
268
268
DataOutputStream out = new DataOutputStream (bos );
269
269
270
270
HorizontalHeaderTable h = ttf .getHorizontalHeader ();
@@ -308,7 +308,7 @@ private boolean shouldCopyNameRecord(NameRecord nr)
308
308
309
309
private byte [] buildNameTable () throws IOException
310
310
{
311
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
311
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (512 );
312
312
DataOutputStream out = new DataOutputStream (bos );
313
313
314
314
NamingTable name = ttf .getNaming ();
@@ -393,7 +393,7 @@ else if (encoding == 1) // ISO 10646=
393
393
394
394
private byte [] buildMaxpTable () throws IOException
395
395
{
396
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
396
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (32 );
397
397
DataOutputStream out = new DataOutputStream (bos );
398
398
399
399
MaximumProfileTable p = ttf .getMaximumProfile ();
@@ -428,7 +428,7 @@ private byte[] buildOS2Table() throws IOException
428
428
return null ;
429
429
}
430
430
431
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
431
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (78 );
432
432
DataOutputStream out = new DataOutputStream (bos );
433
433
434
434
writeUint16 (out , os2 .getVersion ());
@@ -476,7 +476,7 @@ private byte[] buildOS2Table() throws IOException
476
476
// never returns null
477
477
private byte [] buildLocaTable (long [] newOffsets ) throws IOException
478
478
{
479
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
479
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (newOffsets . length * 4 );
480
480
DataOutputStream out = new DataOutputStream (bos );
481
481
482
482
for (long offset : newOffsets )
@@ -598,7 +598,7 @@ else if ((flags & 1 << 3) != 0)
598
598
// never returns null
599
599
private byte [] buildGlyfTable (long [] newOffsets ) throws IOException
600
600
{
601
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
601
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (512 );
602
602
603
603
GlyphTable g = ttf .getGlyph ();
604
604
long [] offsets = ttf .getIndexToLocation ().getOffsets ();
@@ -749,7 +749,7 @@ private byte[] buildCmapTable() throws IOException
749
749
return null ;
750
750
}
751
751
752
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
752
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (64 );
753
753
DataOutputStream out = new DataOutputStream (bos );
754
754
755
755
// cmap header
@@ -869,7 +869,7 @@ private byte[] buildPostTable() throws IOException
869
869
return null ;
870
870
}
871
871
872
- ByteArrayOutputStream bos = new ByteArrayOutputStream ();
872
+ ByteArrayOutputStream bos = new ByteArrayOutputStream (64 );
873
873
DataOutputStream out = new DataOutputStream (bos );
874
874
875
875
writeFixed (out , 2.0 ); // version
0 commit comments