Label font size - Label Expression

7609
11
Jump to solution
04-29-2015 11:32 PM
PV
by
New Contributor III

I have an Asian Font ending with a number and a second label which is number only. I label them with the following expression (JScript):

[AsianTextNr]  +  "\r\n"  + "("+ [NumberLabel] + ")"

It looks like the picture bellow.

I set the font size to 16, however the Asian font does not get bigger, anyone is familiar with this problem or knows a way on how to modify the JScript code? (Also suggestions in VBScript and python are welcome) (I work with ArcGIS 10.1)

0 Kudos
1 Solution

Accepted Solutions
SepheFox
Frequent Contributor

Hey P.V., so, you would format your label like this (to make 18pt font for example):

"<FNT size=""18"">" & [AsianTextNr]  & "</FNT>" +  "\r\n"  + "("+ [NumberLabel] + ")"

View solution in original post

11 Replies
WendyHarrison
Esri Contributor

Hi,

How are you trying to change the font size?  through formatting tags in the expression? or through the text symbol font size in the label manager?

thanks

Wendy

0 Kudos
PV
by
New Contributor III

Hi Wendy Harrison
I tried to change it through the text symbol font size in the label manager. would't know how to write the code in JScript.. but anyways, I guess the font still would be smaller then the number, even if changing it with the expression..
Maybe there is a way in the expression to say that all text up to the first number should have a specific size and all the other text/numbers another size?

0 Kudos
SepheFox
Frequent Contributor

Hi P.V., If you want to change the font size of part of your label, you can use a label expression, adding it to the one you have already. There are examples of font size expressions in this help file: ArcGIS Help 10.1

PV
by
New Contributor III

Thank you Sephe for linking me to the help file!
I still could not figure out, how to change only the first part of my first label but if I do, I ll post it here!

0 Kudos
curtvprice
MVP Esteemed Contributor

Here's the current help article with all the tags. (Most things Desktop haven't changed much from 10.1 on, so I like to link the most recent help because there are editorial revisions that have improved things over time.)

The FNT tag allows you to specify any combination of font, size, or scale.

Formatting tags available in ArcMap—Help | ArcGIS for Desktop

Here's an example:

<FNT scale=2>first part</FNT>second part

Some fonts are not set up in TrueType to scale properly. But I think it's worth a try to experiment with the <FNT> tag (try both scale and size and see if either will "take").

SepheFox
Frequent Contributor

Hey P.V., so, you would format your label like this (to make 18pt font for example):

"<FNT size=""18"">" & [AsianTextNr]  & "</FNT>" +  "\r\n"  + "("+ [NumberLabel] + ")"

curtvprice
MVP Esteemed Contributor

This is where I like the Python parser better. Python's string handling is just so much nicer!

"<FNT size='18'>{0}</FNT>{1}({2})".format(
    [AsianTextNr], chr(10) + chr(12), [NumberLabel]) 

The help article seems to direct you to use single quotes for FNT parameters.

SepheFox
Frequent Contributor

Hmmm, interesting. If you go on to the "Using text formatting tags" link in the 10.3 help, it says the same as the 10.1 help, that is: http://desktop.arcgis.com/en/desktop/latest/map/working-with-text/using-text-formatting-tags-about-t...

Tag attributes may be surrounded by either single or double quotes. The following statements are equivalent:

Annotation
<FNT name='Arial' size='18'>My text</FNT> <FNT name="Arial" size="18">My text</FNT> 

Label Expression
"<FNT name=""Arial"" size=""18"">" & [LABELFIELD] & "</FNT>" "<FNT name='Arial' size='18'>" & [LABELFIELD] & "</FNT>" 

Using text formatting tags—Help | ArcGIS for Desktop

curtvprice
MVP Esteemed Contributor

Thanks you're absolutely right. I was thrown off by the information in the table, which seemed to be using double quotes for the annotation expressions and single quotes for the label expressions. I stand corrected!

0 Kudos