ArcGIS for JavaScript 4.21 Emoji in textSymbol - arcgis

Hello I'm using ArcGIS for JavaScript 4.21
I was abel to create a Graphic with poligon. I want to se a title to polygon so I have created another object above it. That object have a type "text" it is a SimpleText object. And it works fine with simple text with letters. But if someone use a Emoji in text it returns a this exception:
[esri.views.2d.engine.webgl.TextureManager] k {name: 'mapview-invalid-resource', details: undefined, message: "Couldn't find font josefin-slab-regular. Falling back to Arial Unicode MS Regular"}
I think it is because of unicode, but in prevous version 3.32, I was able to use Emojies. I can't find out a solution to deal with it. So I want to ask if anyone has encountered this problem. Thank you.
here is my example in code pan.
Problem is on row 144. If you change text: "👩" to text: "Helo" it works.

Tomáš, I don't think that will work.
In 4x, the supported fonts to use with TextSymbol on graphics are limited to the list at https://developers.arcgis.com/javascript/latest/labeling/#fonts-for-featurelayer-csvlayer-and-streamlayer.
In 3x, it worked quite differently, so the font support for TextSymbol was dependent on that specific machines general browser/OS support of fonts.

Related

How do I use fonts in Jetpack Compose for Desktop?

I'm trying to use some font ttf files placed in src/main/resources/fonts/ in JetBrains Compose for Desktop. How do I use the font files in the function androidx.compose.ui.text.font.Font()? I tried using the R.fonts.font_file mentioned in many online articles, but it seems like it only works on Android.
I know that there's this. He's facing the exact same problem I'm having here. I've tried this. Unfortunately, it didn't work. The only answer in the question I linked above says that the solution was to put the font files in src/main/resources and use:
Font(
resource = "font.ttf",
weight = FontWeight.W400,
style = FontStyle.Normal,
)
But it doesn't work. The androidx.compose.ui.text.font.Font() function on my machine requires 3 params, resId, weight, and style.
public fun Font(
resId: Int,
weight: FontWeight,
style: FontStyle,
)
(copied from the Idea tooltip)
As you can see, it requires a resId: Int. How am I supposed to specify it in an Int?
Since JetBrains Compose for Desktop is still in its early beta stage, resources I could find on the web is really scarce. I tried searching for "kotlin resource id" to find the way to refer to the font file as an ID, but all I could find are really Android-targeted things. I also tried searching for "jetpack compose desktop font" and "jetbrains compose font", and the results I get are also flooded with Android things. Yes, I tried using "-android" in the search query, but all that's left in the results are irrelevant. The question I linked is the only thing I could find about Jetpack Compose for Desktop font.
Here's most of my project structure.
Here is the tooltip that IntelliJ Idea shows when I hover over Font(). It isn't that useful, is it?
Kotlin version: 1.5.10
Jetpack compose version: 0.5.0-build225 (latest pre-release)
By the way, I'm using Manjaro Linux on a MacBook if it matters.
You can't use androidx.compose.ui.text.font.Font for this. Import androidx.compose.ui.text.platform.Font instead.
Perhaps counter-intuitively, androidx.compose.ui.text.platform.Font is a valid parameter type in a androidx.compose.ui.text.font.FontFamily, and supports resource, weight and style.

Gujarati fonts not displaying in PDF properly using itext 5.5.5 and xmlworker 5.5.5

I am using arial .ttf file. I have tried different font file for gujarati such as lohit, padmaa, shruti but it not displaying properly. The characters are not getting substituted properly.
In PDF it displays as :
અરથ પરજ ડરમ વૈભવ સવગે
Originally it should display as:
અર્થ પ્રજા ડ્રમ વૈભવ સ્વર્ગે
I have tried using GlyphSubstitutionTableReader but its not working for me.
Please guide me. Thanks in advance.
iText 5 currently doesn't support any Brahmic scripts. The reason is that these require an implementation of a specific font table called GSUB, which simply isn't there yet. There is no way to get this to display correctly with iText 5.5.5, but anyone is welcome to try and implement it.

Using a <style> definition makes a font unfindable in jasper reports pdf export?

I have a jar I include with my application with some fonts. If I paste around
<font fontName="NimbusSansGlobal Light" size="12" pdfFontName="NimbusSansGlobal Light" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
into all my text elements, PDF output works fine. If I switch them all to use a style which defines the font as such:
<style name="SansFontStyle" isDefault="true" pdfFontName="NimbusSansGlobal Light" pdfEncoding="Identity-H" isPdfEmbedded="true"/>, then the font can't be found by the JRLoader when I try to generate reports. Interesting enough, if I use JRLoader within my application directly, the font is found fine.
Why would styles break PDF export?
Using Font Extensions should solve this problem.
Once you use font extensions, then you can set the font in the text element or in the style. You will not specify pdfFontName, pdfEncoding, or isPdfEmbedded in the report. That gets specified in the font extension.
Note: In a strict interpretation, this doesn't actually answer the question. I have no idea why styles work differently from directly setting the fonts. It seems like a bug, but maybe it's unexpected yet intentional for some reason we aren't thinking of. Therefore, I started to enter this as a comment rather than an answer. But it got too long.
Regardless, this should allow you to use styles as you want to. So I expect that it will solve the heart of the problem.
Font extensions are documented in the JasperReports (and iReport) samples and documentation, so it should be pretty easy to use them once you know that you ought to.

Adobe Flex 3: can I get TTF/OTF system fonts and embed at runtime?

Adobe Flex 3: can I get TTF/OTF system fonts and embed at runtime?
Hi,
I'm a Stack Overflow noob so please go easy on me.
I've searched all day and found dozens of tutorial/examples on how to use [Embed] metadata or
Flash SWF files but they all tell me to either use a path in the source attrib or a text string in the systemFont attrib. What I want to do is; at runtime get all installed fonts on a given machine, determine which are TTF/OTF, embed them all and offer them in a comboBox. Something along these lines;
public function embedFonts():void{
try{
//get all device and embedded fonts
availableFonts = Font.enumerateFonts(true);
availableFonts.sortOn("fontName", Array.CASEINSENSITIVE);
for each(var thisFont:Font in availableFonts)
{
[Embed(systemFont=thisFont.fontName,
fontName=thisFont.fontName,
mimeType='application/x-font')]
//this bit need to create a unique variable name on each loop
var thisfont:Class;
}
}
catch(error:Error){
//if cant embed it's likely not to be TTF or OTF
//so move on to the next font.
}
}
Does anyone know a way?
Many, many thanks
You can't embed fonts at runtime.
And what would be the point?
Your swf runs on my machine, enumerates fonts on my machine, then embeds them
and offer them back to me? They are installed, use them directly, no need to embed.
So not only that is it not possible, but probably nobody will ever implement such a feature.

Special characters in iText

I need help in using these symbols ⎕, ∨, ๐, Ʌ, and so on. But when I create a PDF with iText these symbols do not appear.
What can I do so that these symbols appear?
You have to use a font and encoding that contains those characters. Your best bet is to use IDENTITY_H for your encoding, as this grants you access to every character within a given font... but you still have to use the right font.
There are several font-manipulation examples within "iText in Action's" chapter on fonts:
http://www.itextpdf.com/book/chapter.php?id=11
The examples are down the right side. Buying the book would probably help too.
I had the same problem too and I figured out using IDENTITY_H for encoding is working fine.
For example:
java.awt.Font f =...;
Font font = FontFactory.getFont(f.getName(),BaseFont.IDENTITY_H)
I don't understand why with BaseFont.WINANSI it doesn't work. Winansi is the standard Windows Cp1252 character set, that one used by my JVM. So, if the char is correctly displayed in Java, why it is not the case for PDF?
You can escape them according to the unicode escape sequence defined in the java language specification. See http://java.sun.com/docs/books/jls/first_edition/html/3.doc.html
If you are using IntelliJ IDEA for your code you can download the StringManipulation plugin, that does the escapes for you. In the settings of IDEA you can also set the "Transparent native-to-ascii conversion" checkbox under File encodings, and this should help do the trick.
square in pdf file by iText:
BaseFont bf = BaseFont.createFont("c:/windows/fonts/arialbd.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
question.add(new Phrase("\u25A1", new Font(bf, 26)));
You can see a pdf file exemple here