Error using text2image Font Exocet Light failed with 223518 hits = 99.94% when trying to build image file using Diablo 2 font - tesseract

I am running tesseract on windows 11 using the command prompt.
The text file is my training data. Words that I want to turn into images.
The output is the next step in the Tesseract process for training my font.
I am saying find fonts but I only have one font in the folder.
text2image --text="C:\PythonProjects\DiabloTesseractTrainFont\text.txt" --outputbase="C:\PythonProjects\DiabloTesseractTrainFont\Output\Dia.font.exp0" --fontconfig_tmpdir="C:\PythonProjects\DiabloTesseractTrainFont" --find_fonts --fonts_dir="C:\PythonProjects\DiabloTesseractTrainFont\Diablo Fonts"
The result:
Total chars = 223645
Font Exocet Light failed with 223518 hits = 99.94%
Not sure why it fails. I have built something similar to this before. I have tried with a font file that I know has worked and it does the exact same thing.
Any help would be appreciated.

I solved it. In the text file, there were some characters that had been changed when I read them into python. I believe they used to be bullet points but when I read the file I had implemented in python ASCII encoding and ignore errors. I figured that those characters would be removed. I was wrong. Those bullet points were replaced with text that said PAD. I found it in notepad++ and highlighted one of them and then replaced them with a space. Note in Notepad++ when I did the replace it did not have anything in the find field but it still replaced all of them. Now it compiles just fine. I was stuck for many hours I hope this helps someone.

Related

FileMaker Error: PDF could not be created on this disk

I don't really know if this would be a good place to ask this question, but FileMaker's forums haven't really been all that helpful. Our graphics department recently has been having issues with a script that they have been using for a few years now, and it just stopped working. I know nothing about FileMaker's language and have never used it before, I've just been asked to try and get it figured out.
The version that we are using is Advanced Pro 18.
Here is a snapshot of the script that is being run
This is the error it produces:
Any help would be appreciated, Thanks!
Check, if there is any font used in layout is missing in their computer.
If there are any fonts with upper case extension (.TTF), change it to lower case (.ttf)
It it is not the case, try Arial font for all the fields in the layout.
Make sure you have enough space.
Make sure your pdf document with the same name is not open.
Reinstall your pdf reader.
Suggestion: You can make the script step more simple.
You should use full file path to set the $Filename variable in line 7 and line 18, like these:
in Windows:
Set Variable [$Filename; Value: "filewin:/DriveLetter:/DirectoryName/" & Log Book::calculate job # & ".pdf"]
or in Mac:
Set Variable [$Filename; Value: "filemac:/VolumeName/DirectoryName/" & Log Book::calculate job # & ".pdf"]
One late additional note: make sure the filename is free of "prohibited" characters. If the string produced by Log Book::calculate job # included a "/" character, for example, you'd likely see the same error message.

ghostscript not creating exact images

I am running below script to create images from postscript file, the images are coming but on first page watermark is not there.
gs -dUseCIEColor -dNOPAUSE -sDEVICE=jpeg -dFirstPage="1" -dLastPage=2 -sOutputFile=outputImage_%0d_A.gif -dJPEGQ=100 -r300 -q inputFile.ps -c quit;'
I am giving the link of ps file which i am using.
http://speedy.sh/Y7vWj/inputFile.ps
Can anybody please help!!!!
Thanks in advance...
OK you haven't stated what version of Ghostscript you are using, nor have you been very clear about what is missing. By 'watermak' do you mean the dark grey text 'PAULDAVIS' written diagonally across the very dark grey rectangle ?
If so then I can see that using the current version of Ghostscript and your command line, its not missing
A few observations on your command line:
-dUseCIEColor - Don't use this unless you know exactly what you are doing and why you want this, I'm guessing you don't (because you have not set any Color Rendering Dictionary). With this you get very dark grey text which is nearly invisible against the very dark grey rectangle. Not surprising since this relates to colour management.
You've set the device to jpeg, but you've set the output file to have a .gif extension.
You are using -dFirstPage and -dLastPage which have no effect when the input is not PDF (though this is added as a new feature in unreleased code).
You've set FirstPage=1 and LastPage=2 on a 2 page file.....
You have set -dFirstPage="1", which isn't going to work for any code which parses and uses it. The quotes won't work.
I'd recommend you do not set -q or -dQUIET when trying to diagnose problems, telling Ghostscript to be quiet will potentially mean you miss useful information.
-c quit; -c means 'process the next part of the command line as PostScript'. But quit; isn't valid PostScript (the semicolon should not be present) and will throw a PostScript error. If you want GS to exit after processing, consider simply using -dBATCH.

jasper text field getting truncated

I'm having a font issue with my jasper report where one of my more wordy text fields (the last one in a detail band) is getting cut off in the PDF and PDF Preview but not in the Internal Preview.
e.g.
Internal Preview:
Here is a fake description. It fits
perfectly, fitting just in the lines.
PDF Preview
Here is a fake description. It
fits perfectly, fitting just in the
Jasper is (seemingly) using some algorithm to figure out how tall the field should be, my text is barely fitting, then when the PDF is generated the text wraps and disappears on the next line.
I'm not using custom fonts (just the default/implicit "SansSerif"), and not using any custom styles beyond bold/italic. This behavior is demonstrable in both iReport's PDF Preview and my code's generated PDF on Windows and MacOS (Linux likely still has the issue, but my example text didn't exhibit the behavior on Ubuntu).
I've played with Stretch Type, Position Type, and Stretch with Overflow, as well as moved this text field to its own band but none fixes this bug (and several of them cause others).
I've had luck changing the font to the other built-in fonts, but this just tells me my example doesn't work for that particular font, not that I've fixed the bug.
Any tips would be greatly appreciated.
Update 1
I tried upgrading from Jasper Reports 5.2.0 to 6.2.0 and Jasper Fonts 4.0.0 to 6.0.0... no change.
Update 2
Tried editing my src/main/resources/jasperreports_extension.properties and adding
net.sf.jasperreports.export.pdf.force.linebreak.policy=true
... no change.
(Notably though in my use-case I can't use isStretchWithOverflow="true", so this may be why it didn't work.)
Update 3
I tried embedding the font by editing src/main/resources/jasperreports_extension.xml and adding:
net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.arialFontFamily=fonts/customFontFamilies.xml
customFontFamilies.xml:
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="ArialEM">
<normal><![CDATA[fonts/Arial/Arial.ttf]]></normal>
<bold><![CDATA[fonts/Arial/Arial Bold.ttf]]></bold>
<italic><![CDATA[fonts/Arial/Arial Italic.ttf]]></italic>
<boldItalic><![CDATA[fonts/Arial/Arial Bold Italic.ttf]]>/boldItalic>
<pdfEncoding><![CDATA[Cp1252]]></pdfEncoding>
<pdfEmbedded><![CDATA[true]]></pdfEmbedded>
</fontFamily>
</fontFamilies>
... no dice. (Though this did help with an issue where Firefox's PDF renderer wouldn't render bold fonts.)
Update 4
I noticed that in all the test-cases I was able to create that the first line was blank, so I changed the particular cell to be vertical-align top, which worked, but of course made that one cell misalign when there wasn't much text in it.
Scrapped that as a solution, but may work for someone.
Update 5
At this point hopefully it's clear I've tried the "real" solutions and watched them all die a horrible death. Thus, we enter the realm of the hack solution. First I tried #wmmci's solution, but his answer changes the height of my box (due to it being dynamically calculated by Dynamic Jasper). I noticed that all of the examples I could create involved intra-word periods in the string, e.g. "foo...bar". That might not be your case, but it was for me. So I injected a "hair space" ( ) after intra-word spaces.
This is obviously not a real solution, just a temporary work-around until I'm able to find more examples of the bug.
Update 6
I checked and I don't have #KarolisŠarapnickis's issue with the printOrder. Ah well. I shall soldier on. ;-)
I had same issue and I tried all possible configurations - didn't work. Finally as a workaround I appended a new line character to the field and it worked.
Something like this: $F{description} + "\n"
Had the same issues with text being truncated and nothing seemed to work.
luckily I found out that my root xml element had the following attribute:
printOrder="Horizontal"
Removing it solved my issues.
Well, i'm not sure if you're struggeling with the exact same problem i was.
But my solution was setting the property "net.sf.jasperreports.print.keep.full.text" of the field to "true".
In my case, I had really long text in a single text field. Adding a line break would solve the issue for some cells, but not for the really long ones that spanned pages. To finally solve it, I had to set the text field to stretch to RELATIVE_TO_BAND_HEIGHT. Previously, it was set to RELATIVE_TO_TALLEST_OBJECT. My guess is that, RELATIVE_TO_TALLEST_OBJECT was being calculated incorrectly (lower than needed).
This did the trick:
textField.setStretchType( StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT );
Seems like the only working solution is to put some text formating signs as #wmmcii said. Then another text renderer is used (discused here). However the new line \n is not ideal, because there is unwanted influence to the output doc. Better solution seems to put tab sign \t to the end of the line. To avoid additional problems when using Horizontal Alignment = Justified, put also a space prior to tab sign. For example:
$F{my_text} + " \t"

Build fails with validation failed in Localizable.strings

I made Localizable.string files and compiled my project (my source code uses NSLocalizedString macro function) but my project doesn't compile because of the Localizable.string file. If I comment all the lines in the Localizable.string file, my project compiles successfully.
As result, the problem is related with the Localizable.string files. I searched about it on Google, I found that UTF-8 files (Localizable.string) has changed to UTF-16. And though I tried this... this way didn't work, too.
===============================================================
My Localizable.string file contains:
"LOCAL_APP_GRADE" = "Basic"
"LOCAL_APP_LAST_UPDATED_DATE" =
"2011/04/20"
"LOCAL_MAIN_MENU_TITLE" = "Main Menu"
In my source code:
NSLocalizedString( #"LOCAL_MAIN_MENU_TITLE", #"" );
Error message:
Copy .strings file Error Validation failed: The data couldn't be read because it has been corrupted.
I'm assuming Xcode 4 here. Double check what it shows for the encoding on each of the Localization.string files in the file inspector. When I was having that error it was due to one of the files being read as Mac Roman instead of UTF-16. Once I changed the encoding the warning went away. What was driving me nuts at first was that the warning was only happening in Xcode 4. Xcode 3 did not give it.
You also have an issue with the formatting of your .string file. All of the lines should end in a semicolon.
"LOCAL_APP_GRADE" = "Basic";
"LOCAL_APP_LAST_UPDATED_DATE" = "2011/04/20";
"LOCAL_MAIN_MENU_TITLE" = "Main Menu";
I don't think this is the cause of the warning though. At least I've never seen a warning for it. It usually only manifests itself at runtime when LOCAL_MAIN_MENU_TITLE shows up in app instead of Main Menu. It would be nice if the build process did check for semicolons though. It's easy to miss adding one when editing the files.
Per Apple:
If you run into problems during testing and find that the functions
and macros for retrieving strings are always returning the same key
(as opposed to the translated value), run the /usr/bin/plutil tool on
your strings file. A strings file is essentially a property-list file
formatted in a special way. Running plutil with the -lint option can
uncover hidden characters or other errors that are preventing strings
from being retrieved correctly.
Fire up a console window, go into your project folder, and do:
/usr/bin/plutil -lint ja.lproj/Localizable.strings
(obviously replace the correct language folder name). This will tell you exactly where the problem is!
All of the lines in .strings file should end with a semicolon. It worked for me.
I had the same issue today after importing the localisations from Apple Notes and the cause was really subtle. The standard double quotes had been swapped with slanting double quotes.
Slanting double quote: ”
Standard double quote: "
I've been struggling with this same error, and ended up having a couple similar issues, but with different details. First off, even though it appears that Xcode's internal "builtin-copyStrings" tool should be able to handle either little-endian or big-endian UTF-16 files, it really only handles big endian. My theory is it's running some extra validation step (perhaps using the plutil command line utility) that didn't used to happen in Xcode 3, and that tool barfs on anything but big-endian UTF-16. Not entirely sure though.
The second trick is that you need to make sure your strings files are saved with no BOM (Byte Order Marker). I did some editing of my .strings files in BBEdit, which ended up saving a BOM to the file, and that also appears to make Xcode 4 have a conniption fit. Xcode itself doesn't appear to have any way to remove the BOM from the file, so this has to be done in a text editor such as BBEdit or TextWrangler which can do that for you.
With Xcode 10.1, one missing semicolon stops compilation with this error:
Localizable.strings: read failed: Couldn't parse property list because
the input data was in an invalid format
BTW, you can find out if the error is general to your file (an encoding issue) or specific to one or more lines by temporarily removing most of the file content. You can then locate the problem by incrementally adding content back in until the error returns.
Perhaps you have something like:
"Bla"="bla";;
Note the duplicate ; symbol. If you have that, it will compile properly but will fail in run time.
Related to this - take care when manually merging strings into Localizable.strings - I managed to copy/paste BOTH strings from a NSLocalizedString() macro, so that the Localizable.strings entry was in this form:
"KEY" = "STRING", #"COMMENT STRING COPIED ACROSS ALSO, IN ERROR";
The bit ,#"xxx" on building caused me to get the error:
Read failed: The data couldn't be read because it isn't in the correct
format.
In this case doing a quick search on #" helped identify the places I'd done this.
I had this problem. My fix? Add a newline at the top of the file. Bizarre but it got it working for me.
So instead of at the top of my file having this:
/* comment */
"LOCAL_APP_GRADE" = "Basic"
I had to do:
[newline]
/* comment */
"LOCAL_APP_GRADE" = "Basic"
(Can't get the formatting right - don't type 'newline', just hit return!)
Looks like this is an standard message for error reading the strings file.
In my case it was a (json force of habit) colon instead of equal sign:
"key1" = "String1";
"key2" : "String2";
"key3" = "String3";
Changed it to = and everything worked fine.
My problem was, that I've forgotten ; in one of the lines
Make sure that you have declared string in following format:
"YOUR_STRING_LABEL" = "Your message";
Note: Don't forget Quotation Marks ("), Equals Sign (=) and Semicolon (;) at end.
This may be because the translation file format is wrong. You can download a mac software called Localizable.
This is the download link: https://apps.apple.com/cn/app/localizable-翻译文件工具/id1268616588?mt=12
You only need to drag Localizable.strings file to the software. and it willtell you which line in the file may have a problem.
It is useful .It saved me a lot of time. Now I share it with you, I hope it will be helpful to you.

Localizable.strings woes

My Localizable.strings file has somehow been corrupted and I don't know how to restore it.
If I open it as a Plain Text File it starts with weird characters that I can't copy here.
If I leave the file be the app builds. If I make any changes either the values aren't interpreted properly or I get an error at compile time.
Localizable.strings: Conversion of string failed. The string is empty.
Command /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copystrings failed with exit code 1
I suspect this is an encoding problem but I don't know how it happened (maybe SVN is to blame?) nor how to solve it. Any tips will be much more appreciated.
I have issues with the same file that sound very similar to your own. What happens for me is that Xcode doesn't know the correct file formating. I often get this when rearranging the project and I remove and re-add this file to the Xcode project. When I re-add the file, its encoding gets set to something like Western Roman which can't seem to render anything other than ASCII.
Here's what I do to fix the problem:
In Xcode select the Localizable.stings file in the Groups&Files panel.
Do a Get Info on that file.
On the info panel select the General tab.
In that tab go to the File Encoding and change its value.
The last step is where the trick lies as you now have to guess the right encoding. I find that for most European languages that "Unicode (UTF-8)" works. And for Asian languages I find that "Unicode (UTF-16/32)" are the ones to try.
I just had that error because I forgot a semicolon. Took me a while to figure it out. Seems like a really ambiguous compiler error but the fix was simple.
Make sure in File-Get Info, that UTF-16 is selected. If it's set to none or UTF-8 as encoding then you need to change it. If your characters have spaces between them then you choose to "re-interpret" the file as UTF-16. If there are weird characters in the file, then you need to remove them.
Execpt the UTF-8 problem, sometimes you still have to check the content in case if there are some syntax problems.
Use the following Regular Expression to verify your text line by line, if there's any line not matched, there must be a problem.
"(.+?)"="(.+?)";
You can use the plutil command line tool. Without options or with the -lint option, it checks the syntax of the file given as argument. It will tell you more precisely where the error is.
This happens to me when there is a missing quote or something not right with the file. MOst commonly, since my language files are done by another team member, he tends to forget a quote or something. Usually XCode shows an error on that line, sometimes it does'nt and just throws "Corrupted data" error.
Double check if all your strings are properly closed in quotes
Open the file in Xcode.
Right click it in Project Navigator.
Select Open as -> ASCII Property List