I have the following code:
class Terminal {
PFont font;
Terminal() {
font = loadFont("Serif-48.vlw");
}
}
It gives the error "java.lang.RuntimeException: Could not load font Serif-48.vlw. Make sure the font has been copied to the data folder of your sketch." even when I have verified that the font is already in the correct folder. The example sketches that come with Processing that use fonts in the exact same way work perfectly fine.
I'm using Processing 1.5.1 on Mac OS X 10.7.1 with the packaged version of Java (1.6.0_26-b03-383).
I've just tried you're class and if I create the font it works fine.
Try deleting your current vlw file and going to Tools > Create Font... in
the Processing IDE to recreate Serif-48 (should be the default one).
My current setup is Processing 2.0a1 on OSX 10.6.8.
If the samples work fine, it's clearly something wrong with that particular sketch.
Try recreating the font as I mentioned above, and if that doesn't work, either
create a new sketch from scratch and test the font first, then continue bringing your
other classes/functions in, either save a version of a sample that works and change
it into the sketch you need.
HTH
Also, you can install the file onto the machine as a ttf. And call it that way with createFont.
Example:
// declare exfont to be of the data type PFont
PFont exfont;
// createFont(name, size, smooth, charset)
exfont = createFont("nameofthefontfileonyourmachine", 60, true);
textFont(exfont);
one other problem you may run into with this method. if you are trying to use a .otf on Windows 7 ... you will need to convert and install the file as a .ttf for Processing to recognize it and use it in the sketch.
Related
I have an application with the following structure:
./Data/test.txt
./TestMacOSApp
So my TestMacOSApp opens ./Data/test.txt and uses the content of test.txt. This app was working for a long time either on my MacBook or others MacBook. Recently I noticed that the app works on my MacBook fine,
but on others it crashes throwing "File is not found exception".
I create TestMacOSApp using XCode v9.1.
MacOS version is 10.12.6.
The App creation steps are Archive->Export->ExportApp (Without re-signing).
Does someone else have such an issue?
How can I solve this issue?
I don't know how you open the file because you didn't provide the code which does this.
But I know that, when you export your app on other computers, it is important to calculate the real path with fullPathForFilename, instead of giving directly the path that you know. Like this:
auto fileUtils = FileUtils::getInstance();
string content = fileUtils->getStringFromFile(fileUtils->fullPathForFilename(filename));
Have you done this? If you have, and it doesn't work, your file is probably just not where you expect it to be, so please check again.
I am having issues getting lockPref working on my Mac. I have followed instructions here, as well as looking in other places for solutions. I have created a mozilla.cfg file, as well as a local-settings.js file in /Applications/Firefox/Contents/Resources/defaults/pref, as follows:
mozilla.cfg
//
lockPref("extensions.shownSelectionUI", true);
lockPref("extensions.autoDisableScopes", 11);
local-settings.js
pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");
These are both saved using Windows Latin encoding (have tried Windows Roman too). When opening Firefox, I am getting an error dialogue saying, "Failed to read the configuration file. Please contact your system administrator". I'm not sure where to go from here, as other solutions have involved UTF encoding problems and incorrect configuration values - I saved an empty mozilla.cfg file to attempt to rule that out, and the problem still persists.
FYI I'm using OS X 10.11.5 and Firefox 42.0. Thanks.
So, I didn't have mozilla.cfg in the correct location - I was storing it in the prefs folder with the local-settings.js, which is incorrect.
File locations are now as follows:
/Applications/Firefox.app/Contents/Resources/mozilla.cfg
/Applications/Firefox.app/Contents/Resources/defaults/pref/local-settings.js
I haven't been able to find a thread that solves my issue yet so opening this one up. I'm trying to install the font but it is giving me an error on install. We would like to use it in a desktop format initially so that document can be passed around internally and edited before putting on our site. I have read it should be good 'our-of-the-box' to install with no issues, however, when trying to install the font this is the error message I get:
"Cannot install FontAwesome.otf
The file '\common.ecamericas...\FontAwesome.otf' does not appear to be a valid font"
This happens for the true type font file as well. Any help would be appreciated so we could hash out which icons we would like to use without all getting in a single room together.
Thanks.
Try to install it with admin or root account
Whenever I press on the open in IE icon, I get an error in the console:
Error: NS_ERROR_FILE_NOT_FOUND: Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIProcess.init]
Source File: chrome://openinie/content/openinie.js
Line: 126 (This happened ever since upgrade to 16.0 and I assume it's probably security related)
I found that js file to be inside some "openinie#wittersworld.com.xpi" file (which I cleverly renamed to zip), and saw the offending line:
var iePath = openinie.getIEPath();
// create an nsILocalFile for the executable
var file = Components.classes["#mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(iePath);
// create an nsIProcess
var process = Components.classes["#mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(file); // <-line 126
is it possible to fix it and "re-compile" it zipping and renaming?
(I assume it's something with security maybe).
can I debug this using for example an alert box to display values of variables?
is it possible to fix it and "re-compile" it zipping and renaming
Yes, you can simply replace a file in the ZIP archive, most extensions aren't signed (you can remove the META-INF directory from the XPI file if this one is). In fact, for your debugging it is better to unpack openinie#wittersworld.com.xpi into a directory named openinie#wittersworld.com in the same folder and remove the original file - this way you won't need to pack/unpack on each change. You should also start Firefox with the -purgecaches command line parameter, otherwise the file you are changing might get cached.
can I debug this using for example an alert box to display values of variables?
Yes. However, I would rather recommend Components.utils.reportError() method that will log to the Error Console (press Ctrl-Shift-J to open it) without opening modal dialogs. In this particular case I would write:
Components.utils.reportError(iePath);
This seems to point to a non-existent file meaning that the getIEPath() function is faulty.
Good luck!
How do I get bundled images with the BlackBerry Eclipse Plugin 1.1 Beta? I copied an image into "res/background.jpg" and tried to load it using Bitmap.getBitmapResource on background.jpg. Unfortunately, the image wasn't found (Illegal argument exception). I tried moving my image file into the src folder as per the advice here, but that didn't work either. I have opened up the .jar file and the background image is present at the root of the .jar file. The option to convert image files to .png isn't selected either.
Links
Could not find sample
Library Reference
Two things:
The res folder needs to be a "source directory" in Eclipse. You can achieve this by right-clicking on the folder and going to "Build Path" -> "Use As Source Folder".
When calling Bitmap.getBitmapResource(), like Michael B. said above, you shouldn't put the folder name in the path. Just call Bitmap.getBitmapResource("background.jpg");
Finally, I'm assuming that because your resource is called "background.jpg" you want it to be the background for a Screen. If this is the case, make sure to set the background using the Screen's Main Manager instead of on the screen itself. For example:
public class MyScreen extends MainScreen
{
public MyScreen() {
getMainManager().setBackground(
BackgroundFactory.createBitmapBackground(
Bitmap.getBitmapResource("background.jpg")));
}
}
When you added the resource to the res folder, did you perform a refresh of the project in Eclipse? If it doesn't 'see' it, the packager ignores it. If you restarted Eclipse, it would pick it up the next time, which might explain why it started working randomly.
This should be the code to load your image, without any directory in the path.
Bitmap.getBitmapResource("background.jpg")
Then put the image in any package of your src directory like in
com.rim.sample.resources
When you say it failed what do you mean? Does it throw an error?
I've found that when I add/change a resource it might not take affect immediately. What I found I need to do is to delete the cod file and run a clean on the project (not just build it), then run the packaging (rapc) command. This should make sure the image is there.