• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Requesting help with setting size of text, please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Requesting help with setting size of text, please


  • Subject: Requesting help with setting size of text, please
  • From: Brian Christmas <email@hidden>
  • Date: Mon, 10 Aug 2015 17:08:28 +1000

G’day

I’ve got a routine that displays the words ‘Green’ & ‘Red’ in a text field in their matching colors, and sets the text to ‘Bold’, but it’s too small. I can’t work out the correct terminology to use the line where I’m setting the Font & Size (myFont), somewhere in the handler, though.

Any advice please?

Regards

Santa

on searchText(itemToSearchFor, stringToSearch, colorToSet)
try
set p to 1
set lenOfSearch to count of itemToSearchFor
set p to 2
# set stringToSearch to MutableStringToSearch as text
set p to 2.1
set foundPositions to my findAll(stringToSearch, itemToSearchFor)
set p to 3
if foundPositions is {} then
set p to 4
return stringToSearch
end if
set p to 5
repeat with i in foundPositions
set p to 7
set attributeRange to {i - 1, lenOfSearch}
set p to 8
set myFont to (current application's NSFont's fontWithName:"Hiragino Kaku Gothic ProN W3" |size|:13)
set p to 8.1
(my (attributedSearchItem's addAttribute:(current application's NSForegroundColorAttributeName) value:colorToSet range:attributeRange))
set p to 8.2
(attributedSearchItem's applyFontTraits:(current application's NSBoldFontMask as integer) range:attributeRange)  -- bold 
end repeat
set p to 9
return my attributedSearchItem
on error errmsg number errnum
tell application "System Events" to display dialog "searchText " & errmsg & " p = " & p as text
end try
end searchText
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Requesting help with setting size of text, please
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Can anyone tell me what's wrong with this code, please?
  • Next by Date: Re: Requesting help with setting size of text, please
  • Previous by thread: Fwd: This forum continues to be hijacked
  • Next by thread: Re: Requesting help with setting size of text, please
  • Index(es):
    • Date
    • Thread