Itext7 - customizing list symbol with checkmark - list

I am trying to customize list symbol with check mark. but its not working. Workaround i did with Image. Please see below sample code.
.setListSymbol("\u2022") - its working fine
.setListSymbol("\u2714") or .setListSymbol("\u2713") not working

Custom list symbol is just like any other text. You have to specify the right font in order to get it work. By default iText works with Helvetica font, one of the Standard Fonts. Helvetica contains U+2022, but does not contain U+2714 and U+2713.
You can specify the font for the list which would contain the necessary glyph and this font will be used in the list symbol. An example of a font containing the glyphs you mention is Arial Unicode.
List list = new List().
setFont(PdfFontFactory.createFont("C:/Windows/Fonts/arialuni.ttf", PdfEncodings.IDENTITY_H)).
setListSymbol("\u2713");
Will create a list with the list symbol you want.
If you don't want to change the font of the whole list, but only change the list symbol font, you can do it the following way:
PdfFont unicodeFont = PdfFontFactory.createFont("C:/Windows/Fonts/arialuni.ttf", PdfEncodings.IDENTITY_H);
List list = new List().
setListSymbol(new Text("\u2713").setFont(unicodeFont));

Related

Checking cells for exact match

Long story short, we have a list of products on our website in CSV. All the product variants are assigned a colour. To save dev time, we've got it set up so that the background-color is the same is the variant name. Eg. background-color: red.
I'm wanting to take our list of products and say highlight all the ones that already have valid HTML colors. I've been able to do this by doing the following:
=regexmatch(C1,"Indianred|Lightcoral|Salmon|Darksalmon|Lightsalmon|Crimson|Red|Firebrick|Darkred|Pink|Lightpink|Hotpink|Deeppink|Mediumvioletred|Palevioletred|Lightsalmon|Coral|Tomato|Orangered|Darkorange|Orange|Gold|Yellow|Lightyellow|Lemonchiffon|Lightgoldenrodyellow|Papayawhip|Moccasin|Peachpuff|Palegoldenrod|Khaki|Darkkhaki|Lavender|Thistle|Plum|Violet|Orchid|Fuchsia|Magenta|Mediumorchid|Mediumpurple|Rebeccapurple|Blueviolet|Darkviolet|Darkorchid|Darkmagenta|Purple|Indigo|Slateblue|Darkslateblue|Mediumslateblue|Greenyellow|Chartreuse|Lawngreen|Lime|Limegreen|Palegreen|Lightgreen|Mediumspringgreen|Springgreen|Mediumseagreen|Seagreen|Forestgreen|Green|Darkgreen|Yellowgreen|Olivedrab|Olive|Darkolivegreen|Mediumaquamarine|Darkseagreen|Lightseagreen|Darkcyan|Teal|Aqua|Cyan|Lightcyan|Paleturquoise|Aquamarine|Turquoise|Mediumturquoise|Darkturquoise|Cadetblue|Steelblue|Lightsteelblue|Powderblue|Lightblue|Skyblue|Lightskyblue|Deepskyblue|Dodgerblue|Cornflowerblue|Mediumslateblue|Royalblue|Blue|Mediumblue|Darkblue|Navy|Midnightblue|Cornsilk|Blanchedalmond|Bisque|Navajowhite|Wheat|Burlywood|Tan|Rosybrown|Sandybrown|Goldenrod|Darkgoldenrod|Peru|Chocolate|Saddlebrown|Sienna|Brown|Maroon|White|Snow|Honeydew|Mintcream|Azure|Aliceblue|Ghostwhite|Whitesmoke|Seashell|Beige|Oldlace|Floralwhite|Ivory|Antiquewhite|Linen|Lavenderblush|Mistyrose|Gainsboro|Lightgray|Silver|Darkgray|Gray|Dimgray|Lightslategray|Slategray|Darkslategray|Black")
However, that's not finding the exact match. For example, it's returned things like Black/ White as having a match, which obviously wouldn't work as a HTML color. It's also found things like 'Swedish Blue', presumably because it's found the Blue.
If your list is in the format as shown and you have another list, say in ColumnI, of valid HTML colours then select ColumnC and: Format > Conditional formatting..., Format cells if... Custom formula is and:
=match(trim(mid(C1,19,len(C1))),I:I,0)
with highlighting of choice and Done.

Unnable to modify or query image sequence path with token <f> from file nodes

I have referenced node, which path of the texture used is an image sequence:
path\file.< f >.iff (I put it separated so that the editor doesn't change it)
When i do getAttr
texture_path = cmds.getAttr('{}.fileTextureName'.format(file_node))
I get:
path\file.0001.iff
Which is the first image of the sequence. It is not the regular sequence, but it is an animated texture, meaning sometimes it is 0001, other times 0002... etc, depending on an animation curve attached to the image Sequence.
How do I get the generic name set for the texture with the wildcard?
If I edit that attribute, Arnold Render tells me is an invalid token. Seems like there's something else happening underneath.
EDITED:
import pymel.core as pc
obj = pc.PyNode( 'textureFileNode')
obj.fileTextureName.get()
Returns the path without the wildcard also.
Seems like there are hidden attributes not shown in the Attribute Editor. Took me a very long time to figure all this out.
Searching in the code executed to update the path when you activate "Use Image Sequence" checkbox, I found these three attributes:
fileNode.textureFileNode : This is not hidden in the UI but the contents of the field correspond to the contents of the variable if there is no image sequence on this file node. Otherwise, if you query it, it returns the first item of the sequence.
fileNode.fileTextureNamePattern : Contains the path shown in the
Image Path field with tokens. This is the one you should query if you
want the path with tokens. Can be modified.
fileNode.computedFileTextureNamePattern : Contains the maya generated
path with tokens. It cannot be changed!
Modifying fileTextureNamePattern will not change computedFileTextureNamePattern . To change it, you need to force Maya to regenerate it modifying fileTextureNamePattern first, then the attribute textureFileNode (in that order!).
Important: The files should exist in order to let Maya regenerate the third parameter. Otherwise, It will not be changed and a mix of paths will be there until you update the UI by doing some change. If you are writing a batch script, it will be all mixed!
Why is that third parameter important, why not use just the fileTextureNamePattern attribute?
computedFileTextureNamePattern is used by Arnold Render, for example, to generate the ASS file. To get the pattern, the internal algorithm in maya tries to get each of them, the last, the textureFileNode. In general, if maya regenerates the third attribute, the second one is empty after that, so it's a better idea to get the generated one.

J2me set font to the whole list

There's a method setFont(int listItem, Font font) in List class which sets some font to the list item. So I have to run through the list items and set fonts in a cycle. Is there any method to set one font to the whole list?
Is there any method to set one font to the whole list?
There is no such method in MIDP 2.
Full list of available methods is provided in lcdui List API documentation - one can easily find out that setFont(int, Font) is the only one way to do that

Up and Down icons in CListCtrl

I have a CListCtrl with multiple columns, all of which are able to be sorted by. I would like to add up and down icons so that it is clear which column is currently sorted upon, and in which direction; much like Windows Explorer. My thought was to add a solid up/down arrow to the column name. I tried using the extended ASCII chars 30/31; but instead of showing the arrows, I got boxes (the "character not found" character); and using the unicode version, I got a question mark instead of the character.
Any suggestions as to how I could accomplish this?
You can use the newer CMFCListCtrl class or the CMFCHeaderCtrl class. There, you can set the sort column and the sort direction.
Try
myListCtrl.SetSortColumn(nCol, bAscending);
or
CMFCHeaderCtrl &headerCntrl = myListCtrl.GetHeaderCtrl();
headerCntrl.SetSortColumn(nCol, bAscending);

sifr menu list problems, height of object calculated wrong

I am using Drupal and have sifr set on list items, and also a, a:hover are set via Drupal so that the links hover. I looked at the sifr3-rules.js file drupal's render module creates and it looks good. and in fact my other sifr items look fine... But the list item ones are goofing for some reason... There is extra space below the list,
so if i have a list item, and inside of that, I have a unordered list with more list items, the Flash Object made in the 1st li (which will cover the rest of the sublist items too), is too bid so you see space under the children until the next parent li comes up. (so looks like extra bottom padding on that portion of the list in IE8... in FF almost similar but each subitem has space at bottom... with javascript turned off, you see the list items look fine by themselves)....
Also if the parent list item is shorter than the sub list items text, the width for the flash object is set only as long as the first list item, and therefore cuts off the rest the sublist item's text.
Any idea how to resolve any of these?
Only unusual thing i see i am doing is setting forceSingleLine and preventWrap (which dont make a difference if taken off).
****Edit, I may just try to figure out how to get Drupal's menu-block module to output a around my hyperlinks in the list items... then i can target the div's with my rule (and the a,a:hover rules will apply), so each menu item gets its own sifr object instead of sifr3 trying to figure out how to do the lists and sublists.
Very useful to me is anyone knows a way to target a hyperlink (<a> tag) and also allow a:hover rules. I know how to do it with pretend another tag that includes hyperlinks, like if i had <h2><a>sometitle</a></h2>, i could have a rule for h2, but then use the a, a:hover rules in the sifr3-rules.js file to target that. so i would need a way to target the hyperlink in the list, but also apply a :hover to it (not sure if this can be done since its not underneith for example the h2 tag).
I just overrode theme_menu_item
to return ''. $link ."". $menu ."\n"; (so added a div class). and used a sifr rule to target '.mymenu .menu_item'. then a sifr flash object is created for each list item hyperlink but won't try to wrap the whole list (and its sublists) like before. Seemed to fix both problems :)