<< Chapter < Page Chapter >> Page >

Usage

Begin by setting the name of the Java object ( textA in Listing 20 ) to the name that you prefer.

Then set the x and y coordinate values for the location in the drawing where the text will be drawn.This specifies the location of the lower-left corner of the first character in the text string.

Then set the name of the font family (" arial " in Listing 20 ) or optionally leave that name blank. If no name is set ("") or an invalid name is set, a default font family will be used.

Then set the font size to the desired font size in points ( 32 in Listing 20 ).

Finally, set the last parameter to the string of text that is to be drawn.

Make sure that you include the quotation marks in both cases where they are used in Listing 20 .

Don't make any other changes to the code shown in Listing 20 .

Setting the font style and font weight

By default the text is normal (not bold, not italic, etc.) . My SVG graphics library provides methods by which you can change the weight and style of thetext, such as making it bold and italic. (See usage instructions for those methods in Listing 27 .)

SVG code to draw text

Listing 21 shows the SVG code produced by the Java code in Listing 20 .

Listing 21 . SVG code to draw text.
<text fill="black" stroke="black" x="225" y="468" font-size="32" font-family="arial">Friction free table.</text>

You should be able to recognize all of the attributes and their values shown in Listing 21 .

The content of an element

There is something in Listing 21 that was not previously discussed in any detail -- content.The actual text, Friction free table , is not an attribute. Instead, it is what is called content in XML/SVG.

In addition, many of the earlier SVG code fragments had elements whose content consisted of a title element, which in turn had text content with words like line , polygon , etc.

This isn't particularly important to you as a user of my SVG graphics library. However, if you elect to create drawings by writingraw SVG code, this is something that you will need to study a little more deeply.

Write the output file

If you elect to create your drawings by writing raw SVG code in a text editor, all you need to do to write the output file is to save the text filefrom inside the editor.

However, if you elect to use my SVG graphics library and create your drawings by writing Java code, you need to include the code shown in Listing 22 to cause the final output SVG file to be written.

(Don't include the .svg extension in the file name that you specify. It is added automatically.)

Listing 22 . Write the output file.
//WRITE OUTPUT FILE SvgLib21.writePrettyFile("Svg21a",doc);

This must be the last statement that you write in your program. Otherwise, you will get an incomplete file.

Set the value inside the quotation marks to the desired path and filename for the file.

(Don't include the .svg extension in the file name that you specify. It is added automatically.)

Don't make any other changes to the code in Listing 22 .

The Java code in Listing 22 writes the output file with the name Svg21.svg in the folder from which the program is being executed (the current folder) . Because it is being written into the current folder, it isn't necessary to provide a path.

Questions & Answers

how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
what is inflammation
Shelly Reply
part of a tissue or an organ being wounded or bruised.
Wilfred
what term is used to name and classify microorganisms?
Micheal Reply
Binomial nomenclature
adeolu
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible physics concepts for blind students. OpenStax CNX. Oct 02, 2015 Download for free at https://legacy.cnx.org/content/col11294/1.36
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?

Ask