LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-09-2017, 09:01 PM   #511
bassmadrigal
Senior Member
 
Registered: Nov 2003
Location: Newport News, VA
Distribution: Slackware
Posts: 4,101

Rep: Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071

Quote:
Originally Posted by gegechris99 View Post
I used this command instead (it can be improved but it worked):

Code:
sed -i 's/\/\* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING[[:space:]]\+\*\//#define TT_CONFIG_OPTION_SUBPIXEL_HINTING/g' include/freetype/config/ftoption.h
This might be able to be improved even more, but this is a bit shorter (and possibly a bit easier to read since there's only two escape characters for the asterisks).

Code:
sed -i 's|^/\* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING \*/|#define TT_CONFIG_OPTION_SUBPIXEL_HINTING|' include/freetype/config/ftoption.h
(Sorry, I like figuring out sed commands to keep my knowledge up.)
 
Old 08-10-2017, 12:10 AM   #512
gegechris99
Member
 
Registered: Oct 2005
Location: France
Distribution: Slackware 14.2 64bit
Posts: 899
Blog Entries: 4

Rep: Reputation: 132Reputation: 132
Taking inspiration from dugan's own sed command, the subpixel hinting patch for 14.2 (freetype 2.6.3) could be even shorter
Code:
sed -i 's|^/\* \(#define TT_CONFIG_OPTION_SUBPIXEL_HINTING\) \*/|\1|' include/freetype/config/ftoption.h
 
1 members found this post helpful.
Old 08-10-2017, 01:47 PM   #513
bassmadrigal
Senior Member
 
Registered: Nov 2003
Location: Newport News, VA
Distribution: Slackware
Posts: 4,101

Rep: Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071
Quote:
Originally Posted by gegechris99 View Post
Taking inspiration from dugan's own sed command, the subpixel hinting patch for 14.2 (freetype 2.6.3) could be even shorter
Code:
sed -i 's|^/\* \(#define TT_CONFIG_OPTION_SUBPIXEL_HINTING\) \*/|\1|' include/freetype/config/ftoption.h
I was curious how this worked, so I did some looking into sed commands. For any others who might be curious, basically you have the string you're searching for:

Code:
/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */
When you search for it using sed, you need to escape the asterisks with a backslash, so it now becomes this:

Code:
/\* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING \*/
Now, since we want a certain portion of it, we can mark it using opening and closing parenthesis. You can do this multiple times to mark multiple blocks of text.

Code:
/\* (#define TT_CONFIG_OPTION_SUBPIXEL_HINTING) \*/
Now, we can use \1 in the replacement section to pull up the pattern. If you did multiple patterns, you can use \2, \3, etc up to 9 different patterns (which would correspond to 9 different sections with opening and closing parenthesis. We're using the pipe symbol | as the delimiter so we don't have to escape the forward slash in the searched text.

Code:
|/\* (#define TT_CONFIG_OPTION_SUBPIXEL_HINTING) \*/|\1|
When we put it all together, we get the following command. Dugan's/gegechris99's commands both had a carat ^ at the front to signify it's the beginning of the line, but based on the text I've seen, it shouldn't be needed because no other lines should match the command (but it doesn't hurt to add it).

Code:
sed -i 's|/\* (#define TT_CONFIG_OPTION_SUBPIXEL_HINTING) \*/|\1|' include/freetype/config/ftoption.h

Last edited by bassmadrigal; 08-11-2017 at 02:25 AM. Reason: Butchered my own post...
 
2 members found this post helpful.
Old 08-11-2017, 02:18 AM   #514
gegechris99
Member
 
Registered: Oct 2005
Location: France
Distribution: Slackware 14.2 64bit
Posts: 899
Blog Entries: 4

Rep: Reputation: 132Reputation: 132
@bassmadrigal

Thanks for detailed info on this particular sed syntax.

Note: you just forgot to put the parenthesis in the last sed command
Please edit your post and correct it as this is supposed to be the command to apply the subpixel hinting patch in 14.2.

Last edited by gegechris99; 08-11-2017 at 02:20 AM. Reason: Add reason for correcting sed command
 
1 members found this post helpful.
Old 08-11-2017, 02:26 AM   #515
bassmadrigal
Senior Member
 
Registered: Nov 2003
Location: Newport News, VA
Distribution: Slackware
Posts: 4,101

Rep: Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071Reputation: 2071
Quote:
Originally Posted by gegechris99 View Post
Note: you just forgot to put the parenthesis in the last sed command
Please edit your post and correct it as this is supposed to be the command to apply the subpixel hinting patch in 14.2.
Thanks for that. That's what I get for typing it up at work without having a bash shell nearby to test it...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
If I were to recompile & arch-optimize Slackware, where to begin? GrapefruiTgirl Slackware 124 06-22-2007 09:46 PM
How to Optimize Slackware 10.2? zeroz52 Slackware 23 10-04-2005 06:42 PM
How to fully optimize Slackware? Introx Slackware 4 05-30-2004 04:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration