- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Simulates bold text in Java
Simulates bold text Create QR Code 2d Barcode In Java Using Barcode generator for Java Control to generate, create QR Code 2d barcode image in Java applications. www.OnBarcode.comQR Code JIS X 0510 Recognizer In Java Using Barcode decoder for Java Control to read, scan read, scan image in Java applications. www.OnBarcode.comYou can change the width of a Chunk with the setScaling() method. In the top right of figure 3.8, the words Foobar Film Festival are scaled to 50 percent of their width, but the height of the glyphs is preserved. This means that the aspect ratio of the letters is changed. You have to be careful not to exaggerate the scaling. At some point, your text will become almost illegible. The setSkew() method expects two parameters. With the first parameter, you change the angle of the baseline. That s what happened in the second line on the right side of figure 3.8: the angle of the baseline is changed to 15 degrees. The second parameter can be used to define the angle between the characters and the baseline. The third line on the right in figure 3.8 looks as if an italic font were used. In reality, the glyphs were skewed 25 degrees. Make UPCA In Java Using Barcode creation for Java Control to generate, create UPC-A image in Java applications. www.OnBarcode.comDrawing GS1 DataBar Truncated In Java Using Barcode encoder for Java Control to generate, create GS1 RSS image in Java applications. www.OnBarcode.comNOTE
Printing Quick Response Code In Java Using Barcode creation for Java Control to generate, create QR Code image in Java applications. www.OnBarcode.comUCC-128 Generator In Java Using Barcode encoder for Java Control to generate, create EAN / UCC - 14 image in Java applications. www.OnBarcode.comIf you have to use a font for which you can t find the corresponding font with italic or oblique style, you can use setSkew(0, 25) to simulate italics. UPC - 13 Drawer In Java Using Barcode creator for Java Control to generate, create GTIN - 13 image in Java applications. www.OnBarcode.comCreate Bookland EAN In Java Using Barcode printer for Java Control to generate, create International Standard Book Number image in Java applications. www.OnBarcode.comFinally, there s the setTextRenderMode() method. These are possible values for the first parameter: Drawing QR Code In Java Using Barcode maker for Eclipse BIRT Control to generate, create QR Code 2d barcode image in BIRT applications. www.OnBarcode.comQR Code 2d Barcode Decoder In None Using Barcode decoder for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comAdding text at absolute positions
Recognizing Code 128A In Visual Basic .NET Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET applications. www.OnBarcode.comMaking Barcode In Objective-C Using Barcode creation for iPad Control to generate, create Barcode image in iPad applications. www.OnBarcode.comPdfContentByte.TEXT_RENDER_MODE_FILL This is the default rendering
Make QR Code In Visual Studio .NET Using Barcode printer for Visual Studio .NET Control to generate, create QR Code JIS X 0510 image in .NET applications. www.OnBarcode.comCode 3/9 Reader In VB.NET Using Barcode reader for .NET framework Control to read, scan read, scan image in .NET applications. www.OnBarcode.commode; the glyph shapes are filled, not stroked.
UPC A Decoder In C# Using Barcode reader for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comCreate QR-Code In Java Using Barcode drawer for BIRT reports Control to generate, create QR Code ISO/IEC18004 image in BIRT applications. www.OnBarcode.comPdfContentByte.TEXT_RENDER_MODE_STROKE This causes the glyphs to be
Encode Barcode In None Using Barcode creator for Microsoft Excel Control to generate, create Barcode image in Excel applications. www.OnBarcode.comPrinting QR-Code In Objective-C Using Barcode generator for iPhone Control to generate, create QR Code ISO/IEC18004 image in iPhone applications. www.OnBarcode.comstroked, not filled. This is shown in figure 3.8: the letters are hollow.
Encode Data Matrix In Java Using Barcode creation for Eclipse BIRT Control to generate, create ECC200 image in Eclipse BIRT applications. www.OnBarcode.comEncode Barcode In .NET Framework Using Barcode generation for .NET Control to generate, create Barcode image in .NET framework applications. www.OnBarcode.comPdfContentByte.TEXT_RENDER_MODE_FILL_STROKE This changes the text state
so that the glyphs are filled and stroked. This state was used in figure 3.1 to cover existing content with the words SOLD OUT in white letters with red contours. PdfContentByte.TEXT_RENDER_MODE_INVISIBLE This will make all the text that is added invisible. The text will be there, but it won t be visible. Two extra parameters define the line width and the color that will be used to stroke the glyph. If you pass a null value for the stroke color, the fill color (defined in the Chunk s Font object) will be used. The final line in figure 3.8 looks as if a bold font were used. If you have to use a font for which you can t find the corresponding font with bold style, you could use setTextRenderMode(PdfContentByte .TEXT_ RENDER_MODE_FILL_STROKE, 0.5f, null) to simulate bold. These attributes also work if you re adding Chunks with document.add(). The timetable for the film festival is almost finished, as you can see in figure 3.9. Timetable without movie titles
Adding content at absolute positions
The only bits of information missing in the figure are the movie titles. It would be nice if you could add the text to the rectangles without having to scale the text or downsize the font size if the title is too long to fit the width of the rectangle. This can t be done with the showTextAligned() method, to which you only pass a single set of (x,y) coordinates; you need an instance of the ColumnText object instead. Working with the ColumnText object
In this section, you ll learn about the different ways to use the ColumnText object: text mode if you only use Chunks and Phrases, composite mode if you want to use other types of high-level objects as well. In listing 3.13, you wrote a showMovieInfo() method. If a screening was reserved for the press, you marked the corresponding time block of the movie with a white, uppercase P . You could try adding the movie title the same way, but the showTextAligned() method isn t able to wrap text. You also can t use newlines in Strings or Chunks using any version of this method. Let s extend the previous example and reuse almost all of its methods. The only change involves the drawMovieInfo() method. Listing 3.15 MovieCalendar.java
protected void drawMovieInfo( Screening screening, PdfContentByte directcontent) throws DocumentException { super.drawMovieInfo(screening, directcontent); Rectangle rect = getPosition(screening); ColumnText column = new ColumnText(directcontent); column.setSimpleColumn( new Phrase(screening.getMovie().getMovieTitle()), rect.getLeft(), rect.getBottom(), rect.getRight(), rect.getTop(), Draws content 18, Element.ALIGN_CENTER); of column column.go(); }
|
|