Sponsored Content
Full Discussion: regex to find font class
Top Forums Shell Programming and Scripting regex to find font class Post 302480722 by tlarkin on Wednesday 15th of December 2010 03:46:12 PM
Old 12-15-2010
regex to find font class

So, I need to find the instances of a certain font and remove it....so far in my testing I am using the find command with regex to find a font I want to pull out. However, I seem to be slightly stuck, and I am sure the beard stroking Unix geniuses here can help me.

My example code:

Code:
find -x -E /* -iregex .*\.arial -print
/Applications/Microsoft Office 2004/Office/Fonts/Arial
/Users/tlarkin/Library/Fonts/Arial
bash-3.2$

This does in fact find Arial, but it doesn't find every class of Arial, like black narrow, etc. I cannot wrap my head around using the string Arial to pull out every instance of Arial....

Thanks in advance for any help. I am running tons and tons of Macs here, so everything is OS X.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find with RegEx

I have some files in unix ls -1 TMH.backend.tar.421E-03.Z TMH.backend.tar.421E-04.Z TMH.backend.tar.421E-05.Z TMH.backend.tar.421E-06.Z TMH.backend.tar.421E-07.Z TMH.backend.tar.421E-08.Z TMH.backend.tar.421E-08.Z.bak20081223164844 TMH.backend.tar.421E-09.Z... (1 Reply)
Discussion started by: on9west
1 Replies

2. Shell Programming and Scripting

Using grep and regular expression to find class references in a c++ file

I'm trying to math all class references in a C++ file using grep with regular expression. I'm trying to know if a specific include is usuless or not, so I have to know if there is a refence in cpp. I wrote this RE that searches for a reference from class ABCZ, but unfortunately it isn't working... (0 Replies)
Discussion started by: passerby
0 Replies

3. Linux

Command to find default font name in Ubuntu OS

Hi, Does anyone know whether there is any console command available to get the info of the default Ubuntu OS or any config file where in I search for the font details? I am using Ubuntu 8.04 and 10.04 (LTS) both together. Thanks (1 Reply)
Discussion started by: royalibrahim
1 Replies

4. UNIX for Dummies Questions & Answers

GREP Find & Replace <p class>

I am making an eBook. I am editing the html in BBedit. I need to replace all <p class="s5"> with just a <p>. How do I write this for GREP? Thank you, Abby (5 Replies)
Discussion started by: cuddlykitty
5 Replies

5. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies

6. Shell Programming and Scripting

Perl::Gtk2 on Linux --- How to Find the Default Font Being Used?

Hello All, Wasn't sure if this was the correct thread to post this under but figured it has to do with Perl and Gtk2 so why not... Anyway.. How can I find out what the Default font being used is inside a Gtk2::Widget. In this case I'm trying to figure out the font being used inside a... (1 Reply)
Discussion started by: mrm5102
1 Replies

7. UNIX for Advanced & Expert Users

Could not find the main class: Grasp. Program will exit.

I am having trouble running jgrasp. I get the message above when I try to run jgrasp. I am running fedora if that makes a difference. I have already set my environmental variable with this. Hopefully I did it right. JGRASP_HOME=/opt/jgrasp export... (0 Replies)
Discussion started by: cokedude
0 Replies

8. Programming

Size of Derived class, upon virtual base class inheritance

I have the two class definition as follows. class A { public: int a; }; class B : virtual public A{ }; The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies

9. Programming

C++ : Base class member function not accessible from derived class

Hello All, I am a learner in C++. I was testing my inheritance knowledge with following piece of code. #include <iostream> using namespace std; class base { public : void display() { cout << "In base display()" << endl; } void display(int k) {... (2 Replies)
Discussion started by: anand.shah
2 Replies

10. Shell Programming and Scripting

Regex issue with \s in character class.

Anybody have an explanation for why \s doesn't match ' ' in a character class? Here are 3 examples with the final example showing that \s in a character class (demonstrated by using egrep -o) fails: \s works outside of class.. # echo " FOO " | egrep -o '\s+\s' FOO Here is a... (6 Replies)
Discussion started by: blackrageous
6 Replies
Imager::Tutorial(3pm)					User Contributed Perl Documentation				     Imager::Tutorial(3pm)

NAME
Imager::Tutorial - an introduction to Imager. DESCRIPTION
Before you start If you have the necessary knowledge, install the image format libraries you want Imager image file support for, and Imager itself, otherwise arrange to have it done. You will also want some sort of image viewer tool, whether an image editor like Photoshop or the GIMP, or a web browser. Hello Boxes! - A Simple Start As with any perl program it's useful to start with a #! line, and to enable strict mode: #!/usr/bin/perl -w # you might to 'use warnings;' instead of the -w above use strict; These lines will be omitted in further examples. As with any module, you need to load it: use Imager; Now create a image to draw on: my $image = Imager->new(xsize => 100, ysize => 100); and draw a couple of filled rectangles on it: $image->box(xmin => 0, ymin => 0, xmax => 99, ymax => 99, filled => 1, color => 'blue'); $image->box(xmin => 20, ymin => 20, xmax => 79, ymax => 79, filled => 1, color => 'green'); Since the first box fills the whole image, it can be simplified to: $image->box(filled => 1, color => 'blue'); and save it to a file: $image->write(file=>'tutorial1.ppm') or die 'Cannot save tutorial1.ppm: ', $image->errstr; So our completed program is: use Imager; my $image = Imager->new(xsize => 100, ysize => 100); $image->box(filled => 1, color => 'blue'); $image->box(xmin => 20, ymin => 20, xmax => 79, ymax => 79, filled => 1, color => 'green'); $image->write(file=>'tutorial1.ppm') or die 'Cannot save tutorial1.ppm: ', $image->errstr; Adding some text The first thing you need to draw text is a font object: # use a different file, depending on the font support you have in # your installed Imager. my $font_filename = 'fontfiles/ImUgly.ttf'; my $font = Imager::Font->new(file=>$font_filename) or die "Cannot load $font_filename: ", Imager->errstr; If you're on Windows, you can supply a face name instead: my $font = Imager::Font->new(face=>'Arial Bold') or die "Cannot load 'Arial Bold: ", Imager->errstr; and draw the text: my $text = "Hello Boxes!"; my $text_size = 12; $font->align(string => $text, size => $text_size, color => 'red', x => $image->getwidth/2, y => $image->getheight/2, halign => 'center', valign => 'center', image => $image); So inserting this into our existing code we have: use Imager; my $image = Imager->new(xsize => 100, ysize => 100); $image->box(xmin => 0, ymin => 0, xmax => 99, ymax => 99, filled => 1, color => 'blue'); $image->box(xmin => 20, ymin => 20, xmax => 79, ymax => 79, filled => 1, color => 'green'); # use a different file, depending on the font support you have in # your installed Imager. my $font_filename = 'fontfiles/ImUgly.ttf'; my $font = Imager::Font->new(file=>$font_filename) or die "Cannot load $font_filename: ", Imager->errstr; my $text = "Hello Boxes!"; my $text_size = 12; $font->align(string => $text, size => $text_size, color => 'red', x => $image->getwidth/2, y => $image->getheight/2, halign => 'center', valign => 'center', image => $image); $image->write(file=>'tutorial2.ppm') or die 'Cannot save tutorial2.ppm: ', $image->errstr; Using an existing image as a base To load an image from a file, first create an empty image object: my $read_image = Imager->new; then call the read method: my $image_source = shift; # from the command-line $read_image->read(file=>$image_source) or die "Cannot load $image_source: ", $image->errstr; To keep to our working size, we'll scale the image: # the scale() method always does a proportional scale, we don't want # that here my $scaled_image = $read_image->scaleX(pixels=>100)->scaleY(pixels=>100); draw our inner box on that, and save the result: $scaled_image->box(xmin => 20, ymin => 20, xmax => 79, ymax => 79, filled => 1, color => 'green'); $scaled_image->write(file=>'tutorial3.ppm') or die 'Cannot save tutorial3.ppm: ', $image->errstr; so the complete program is: use Imager; my $read_image = Imager->new; my $image_source = shift; # from the command-line $read_image->read(file=>$image_source) or die "Cannot load $image_source: ", $image->errstr; # the scale() method always does a proportional scale, we don't want # that here my $scaled_image = $read_image->scaleX(pixels=>100)->scaleY(pixels=>100); $scaled_image->box(xmin => 20, ymin => 20, xmax => 79, ymax => 79, filled => 1, color => 'green'); $scaled_image->write(file=>'tutorial3.ppm') or die 'Cannot save tutorial3.ppm: ', $image->errstr; AUTHOR
Tony Cook <tonyc@cpan.org> REVISION
$Revision$ perl v5.14.2 2011-06-06 Imager::Tutorial(3pm)
All times are GMT -4. The time now is 08:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy