Can't use "Times New Roman Bold" programmatically in Swift 5 - ios13

I'm trying to use UIFont(name: "Times New Roman Bold", size: 30.0) at run time but it's returning nil
Here is my code -
lblHeader.font = UIFont(name: "Times New Roman Bold", size: 30.0)
But lblHeader is returning SFUI-Regular when I printed in the console.
I've tried following combination but no luck -
Times New Roman Bold
Times New Roman-Bold
Times New Roman-bold
Times New Roman bold
TimesNewRoman Bold
TimesNewRoman-Bold

I have found the answer here - iOS Fonts
But thanks to Rup for the help.
I hope this answer will help others.
Happy coding :)

Related

How do I duplicate values in jq?

I am trying to duplicate the values that I've received in jq.
For example: If I enter ".address", I get a value "Times Square, New York"
I want to duplicate it so that it gives me the values:
"Times Square, New York"
"Times Square, New York"
"Times Square, New York"
"Times Square, New York"
One way could be to create a stream of 4 arbitrary items, e.g. numbers using range, store them in a variable to not affect the context, and provide your output for each:
range(4) as $_ | .address
You can also use the comma operator , to manually compile your stream:
.address, .address, .address, .address

Is there a function to modify string (format, bold, center) with Console.Writeline?

I create a file with classic ASP code and it works. Now I want to apply format on my strings (bold, link for example), are there any functions to do this ?
Thanks
Dim file As New System.IO.StreamWriter("REACH.doc")
Dim title As String
title="TITLE"
'''''Here I want to apply bold on title
file.WriteLine(title)
file.Close()

How to change the font of the label's contours in R?

I want to change the font of the labels of the contours to black italic. I have tried using "font",values 1,2,3 or 4, but it doesn't work, with any of those value I keep getting the same plot. I think I'm missing something.
This is the code:
library("ncdf4");library("maps")
file<-"http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP/.EMC/.CMB/.GLOBAL/.Reyn_SmithOIv2/.weekly/.sst/T/%2819-25%20Feb%202017%29VALUES/data.nc"
try(download.file(url =file ,"data.nc",quiet = F,mode="wb"))
data<-nc_open("data.nc")
latGb<-ncvar_get(data,"Y")
lonGb<-ncvar_get(data,"X")
latCb<-latGb[30:121]
lonCb<-lonGb[240:301]
dat<-ncvar_get(data,"sst")
dat<-dat[240:301,30:121]
filled.contour(lonCb, latCb, dat,zlim =c(5:35),nlevels=80,
plot.axes={
contour(lonCb, latCb, dat,nlevels=10,add=T,font=4,labcex=1);
map('world2',col="black",fill = TRUE, add=TRUE);
grid()})
This is want i keep getting:
Pic
Thanks for the help
In contour help file, vfont is a parameter you can set by providing a vector of length 2 where the first element is the typeface, and the second element is the font face. Note, font is not a parameter within contour that you can set, that is why nothing happens when you use this. Always check the help file on what parameters can be set.
I set vfont to bold italic so it appears more solid black than grey. You select the typeface you like, I used the default sans serif.
filled.contour(lonCb, latCb, dat, zlim =c(5:35), nlevels=80,
plot.axes={
contour(lonCb, latCb, dat, nlevels=10, add=T,
vfont=c("sans serif", "bold italic"), labcex=1);
map('world2', col="black", fill = TRUE, add=TRUE);
grid()})

How to place underline on space string in ITextSharp

How to add under line under a spacebar. It is not adding space under the empty spaces.
I tried with 2-3 example and it failed to add underline under space.
1.
para = New Paragraph(New Chunk("abc. ", underlined_font))
cell = New PdfPCell(para)
cell.Border = 0
cell.BorderWidthBottom = 0
document.Add(cell)
Dim str_required_space As New String(" "c, 20)
para = New Paragraph(New Chunk(str_required_space, underlined_font))
cell = New PdfPCell(para)
cell.Border = 0
cell.BorderWidthBottom = 0
document.Add(cell)
I can't use border of cell as the length of the input string is uncertain. So I am using underline.
Please help to add spaces under space.
My Requirement image
Thanks
[Edit]
If I follow answer 1 then result would be like below
asdasd asdsad scasdnk kjashdk kasbas ckasbd ascuasc ksajcasc
asdansjdnasjakjsnasndasdmlaskdm
________________________________________________________________
But I need Below result.
asdasd asdsad scasdnk kjashdk kasbas ckasbd ascuasc ksajcasc
________________________________________________________________
asdansjdnasjakjsnasndasdmlaskdm
________________________________________________________________
I tried with Ansii Code. Not working for me :(
Dim str_required_space As New String(ChrW(32), (119 - (str_synopsis.Length Mod 119)))
para = New Paragraph(str_required_space)
cell = New PdfPCell(para)
cell.Border = 0
doc.Add(cell)
Please read chapter 2 of my book, more specifically the section about vertical position marks, separators, and tabs (section 2.2.6).
Looking at your image (ignoring the soft porn images on that site, please avoid such links in the future), I think you need a line as shown in figure 2.9 (the line under the names of the directors). The code that results in the PDF shown in that screen shot can be found here.
This is how it's done in Java:
Paragraph p = new Paragraph("abc.");
LineSeparator line = new LineSeparator(1, 100, null, Element.ALIGN_CENTER, -2);
p.add(line);
document.add(p);
It should be a no-brainer to adapt this code to C#. If you do experience problems, then you can find the ported versions of the book samples here.
What did you do wrong in your code?
This doesn't make sense:
para = New Paragraph(New Chunk("abc. ", underlined_font))
The content of the Chunk is trimmed, which explains why the spaces disappear. An alternative would be to use non-breaking space characters (ASCII code 160) instead of regular space characters (ASCII code 32).
Update
My previous answer was based on your image and it was the correct answer to your initial question. However: you have now changed your question (instead of creating a new question).
You can meet your requirement by using a page event, more specifically, by implementing the OnGenericTag() method. This method is described in chapter 5 of my book.
In Java, the implementation would look like this:
public void onGenericTag(PdfWriter writer, Document pdfDocument,
Rectangle rect, String text) {
Rectangle page = pdfDocument.getPageSize();
float x1 = page.getRight(pdfDocument.rightMargin());
float x2 = page.getLeft(pdfDocument.leftMargin());
float y = rect.getBottom() - 3;
PdfContentByte canvas = writer.getDirectContent();
canvas.moveTo(x1, y);
canvas.lineTo(x2, y);
canvas.stroke();
}
You need to create an instance of the page event with that implementation (e.g. a class that you wrote and that you named MyPageEvent) and declare that page event to the PdfWriter using the setPageEvent() method:
writer.setPageEvent(new MyPageEvent());
You can now declare you Chunk and Paragraph like this:
Chunk chunk = new Chunk(long_text);
chunk.setGenericTag("");
Paragraph p = new Paragraph(chunk);
document.add(p);
It is important that you construct your paragraph with only one Chunk object. If you have more than one Chunk in the paragraph, parts of the line will look thicker.

Wrong charset using Gios.Word.WordDocument in ASP.NET

I have inherited ASP.NET project, which is generating some word documents using Gios.Word.WordDocument.
My problem is, everything works fine on my computer, with czech locale, but on english version server some diacritics are missing. I have no experiences with this library, so I don't know where to start.
Basically it works like this:
Gios.Word.WordDocument rd = new WordDocument(WordDocumentFormat.A4);
Font fontRegular = new Font("Arial", 10, FontStyle.Regular);
rd.SetFont(fontRegular);
var rt = rd.NewTable(fontRegular, Color.Black, rows, 2, 10);
WordCell title = rt.Rows[0][0];
title.SetFont(fontRegular);
title.Write("dle vzoru přílohy č. 2 Nařízení vlády č. 201/2010Sb.");
rd.SaveToFile("/* path to file */");
The bad result on the server looks like this dle vzoru prílohy c. 1 Narízení vlády c. 201/2010Sb.
I have tried to set up font this way:
Font fontBold = new Font("Arial", 10, FontStyle.Bold, GraphicsUnit.Point, 238); // 238 eastern europe charset byte
But no chage is happend.
Finally I have modified this library to generate RTF in unicode. Modified version source is published on:
https://github.com/FandaCZ/Gios.Word

Resources