DevWorkst.st
changeset 479 a1ec90f1dc5c
parent 473 e954ce348a47
child 492 e67b71dd143d
equal deleted inserted replaced
478:91a8a5889bf2 479:a1ec90f1dc5c
  2394 
  2394 
  2395 facesInFamily:aFamilyName filtering:filterBlock
  2395 facesInFamily:aFamilyName filtering:filterBlock
  2396     "return a set of all available font faces in aFamily on this display.
  2396     "return a set of all available font faces in aFamily on this display.
  2397      But only those matching filterBlock (if nonNil)."
  2397      But only those matching filterBlock (if nonNil)."
  2398 
  2398 
  2399     |allFonts faces "family face"|
  2399     |fonts|
       
  2400 
       
  2401     fonts := self fontsInFamily:aFamilyName filtering:filterBlock.
       
  2402     fonts size == 0 ifTrue:[^ nil].
       
  2403 
       
  2404     ^ (fonts collect:[:descr | descr face]) asSortedCollection
       
  2405 
       
  2406     "
       
  2407      Display facesInFamily:'fixed' filtering:[:f |
       
  2408         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2409     "
       
  2410 
       
  2411     "Created: 27.2.1996 / 01:33:25 / cg"
       
  2412     "Modified: 29.2.1996 / 04:29:01 / cg"
       
  2413 !
       
  2414 
       
  2415 fontFamilies
       
  2416     "return a set of all available font families on this display"
       
  2417 
       
  2418     ^ self fontFamiliesFiltering:nil
       
  2419 
       
  2420     "
       
  2421      Display fontFamilies
       
  2422     "
       
  2423 
       
  2424     "Modified: 27.2.1996 / 01:31:14 / cg"
       
  2425 !
       
  2426 
       
  2427 fontFamiliesFiltering:aFilterBlock
       
  2428     "return a set of all available font families on this display,
       
  2429      but only those matching aFilterBlock (if nonNil)."
       
  2430 
       
  2431     |fonts|
       
  2432 
       
  2433     fonts := self fontsFiltering:aFilterBlock.
       
  2434     fonts size == 0 ifTrue:[^ nil].
       
  2435 
       
  2436     ^ (fonts collect:[:descr | descr family]) asSortedCollection
       
  2437 
       
  2438     "
       
  2439      Display fontFamiliesFiltering:[:f | 
       
  2440         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2441     "
       
  2442 
       
  2443     "Modified: 29.2.1996 / 04:31:51 / cg"
       
  2444 !
       
  2445 
       
  2446 fontsFiltering:aFilterBlock
       
  2447     "return a set of all available font on this display,
       
  2448      but only those matching aFilterBlock (if nonNil)."
       
  2449 
       
  2450     |allFonts fonts|
  2400 
  2451 
  2401     allFonts := self listOfAvailableFonts.
  2452     allFonts := self listOfAvailableFonts.
  2402     allFonts isNil ifTrue:[^ nil].
  2453     allFonts isNil ifTrue:[^ nil].
  2403 
  2454 
  2404     faces := Set new.
  2455     fonts := Set new.
       
  2456     allFonts do:[:fntDescr |
       
  2457         (aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[
       
  2458             fntDescr family notNil ifTrue:[
       
  2459                 fonts add:fntDescr
       
  2460             ]
       
  2461         ]
       
  2462     ].
       
  2463     ^ fonts
       
  2464 
       
  2465     "
       
  2466      Display fontsFiltering:[:f | 
       
  2467         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2468     "
       
  2469 
       
  2470     "Modified: 29.2.1996 / 04:30:35 / cg"
       
  2471 !
       
  2472 
       
  2473 fontsInFamily:aFamilyName face:aFaceName filtering:filter
       
  2474     "return a set of all available fonts in aFamily/aFace on this display.
       
  2475      But only thise matching filter (if nonNil)."
       
  2476 
       
  2477     |allFonts fonts|
       
  2478 
       
  2479     allFonts := self listOfAvailableFonts.
       
  2480     allFonts isNil ifTrue:[^ nil].
       
  2481 
       
  2482     fonts := Set new.
       
  2483     allFonts do:[:fntDescr |
       
  2484         (aFamilyName = fntDescr family) ifTrue:[
       
  2485             (aFaceName = fntDescr face) ifTrue:[
       
  2486                 (filter isNil or:[filter value:fntDescr]) ifTrue:[
       
  2487                     fonts add:fntDescr
       
  2488                 ]
       
  2489             ]
       
  2490         ]
       
  2491     ].
       
  2492     ^ fonts
       
  2493 
       
  2494     "
       
  2495      Display fontsInFamily:'fixed' face:'medium' filtering:[:f |
       
  2496         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2497     "
       
  2498 
       
  2499     "Created: 29.2.1996 / 04:32:56 / cg"
       
  2500 !
       
  2501 
       
  2502 fontsInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
       
  2503     "return a set of all available font in aFamily/aFace/aStyle
       
  2504      on this display.
       
  2505      But only those matching filter (if nonNIl)."
       
  2506 
       
  2507     |allFonts fonts|
       
  2508 
       
  2509     allFonts := self listOfAvailableFonts.
       
  2510     allFonts isNil ifTrue:[^ nil].
       
  2511 
       
  2512     fonts := Set new.
       
  2513     allFonts do:[:fntDescr |
       
  2514         (aFamilyName = fntDescr family) ifTrue:[
       
  2515             (aFaceName = fntDescr face) ifTrue:[
       
  2516                 (aStyleName = fntDescr style) ifTrue:[
       
  2517                     (filter isNil or:[filter value:fntDescr]) ifTrue:[
       
  2518                         fonts add:fntDescr
       
  2519                     ]    
       
  2520                 ]
       
  2521             ]
       
  2522         ]
       
  2523     ].
       
  2524     ^ fonts
       
  2525 
       
  2526     "
       
  2527      Display fontsInFamily:'fixed' face:'medium' style:'roman' filtering:[:f |
       
  2528         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2529     "
       
  2530 
       
  2531     "Created: 29.2.1996 / 04:25:30 / cg"
       
  2532 !
       
  2533 
       
  2534 fontsInFamily:aFamilyName filtering:filterBlock
       
  2535     "return a set of all available font in aFamily on this display.
       
  2536      But only those matching filterBlock (if nonNil)."
       
  2537 
       
  2538     |allFonts fonts|
       
  2539 
       
  2540     allFonts := self listOfAvailableFonts.
       
  2541     allFonts isNil ifTrue:[^ nil].
       
  2542 
       
  2543     fonts := Set new.
  2405     allFonts do:[:fntDescr |
  2544     allFonts do:[:fntDescr |
  2406         aFamilyName = fntDescr family ifTrue:[
  2545         aFamilyName = fntDescr family ifTrue:[
  2407             (filterBlock isNil or:[filterBlock value:fntDescr]) ifTrue:[
  2546             (filterBlock isNil or:[filterBlock value:fntDescr]) ifTrue:[
  2408                 faces add:(fntDescr face)
  2547                 fonts add:fntDescr
  2409             ]
  2548             ]
  2410         ]
  2549         ]
  2411     ].
  2550     ].
  2412     ^ faces asSortedCollection
  2551     ^ fonts
  2413 
  2552 
  2414     "
  2553     "
  2415      Display facesInFamily:'fixed' filtering:[:f |
  2554      Display fontsInFamily:'fixed' filtering:[:f |
  2416         f encoding notNil and:[f encoding startsWith:'jis']]
  2555         f encoding notNil and:[f encoding startsWith:'jis']]
  2417     "
  2556     "
  2418 
  2557 
  2419     "Created: 27.2.1996 / 01:33:25 / cg"
       
  2420     "Modified: 27.2.1996 / 01:34:11 / cg"
  2558     "Modified: 27.2.1996 / 01:34:11 / cg"
  2421 !
  2559     "Created: 29.2.1996 / 04:27:49 / cg"
  2422 
       
  2423 fontFamilies
       
  2424     "return a set of all available font families on this display"
       
  2425 
       
  2426     ^ self fontFamiliesFiltering:nil
       
  2427 
       
  2428     "
       
  2429      Display fontFamilies
       
  2430     "
       
  2431 
       
  2432     "Modified: 27.2.1996 / 01:31:14 / cg"
       
  2433 !
       
  2434 
       
  2435 fontFamiliesFiltering:aFilterBlock
       
  2436     "return a set of all available font families on this display,
       
  2437      but only those matching aFilterBlock (if nonNil)."
       
  2438 
       
  2439     |allFonts families family|
       
  2440 
       
  2441     allFonts := self listOfAvailableFonts.
       
  2442     allFonts isNil ifTrue:[^ nil].
       
  2443     families := Set new.
       
  2444     allFonts do:[:fntDescr |
       
  2445         (aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[
       
  2446             family := fntDescr family.
       
  2447             family notNil ifTrue:[
       
  2448                 families add:family
       
  2449             ]
       
  2450         ]
       
  2451     ].
       
  2452     ^ families asSortedCollection
       
  2453 
       
  2454     "
       
  2455      Display fontFamiliesFiltering:[:f | 
       
  2456         f encoding notNil and:[f encoding startsWith:'jis']]
       
  2457     "
       
  2458 
       
  2459     "Modified: 27.2.1996 / 01:31:48 / cg"
       
  2460 !
  2560 !
  2461 
  2561 
  2462 fullNameOf:aFontId
  2562 fullNameOf:aFontId
  2463     "return the full name of a font.
  2563     "return the full name of a font.
  2464      Here, we return nil, not knowing anything about fonts"
  2564      Here, we return nil, not knowing anything about fonts"
  2530 sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
  2630 sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
  2531     "return a set of all available font sizes in aFamily/aFace/aStyle
  2631     "return a set of all available font sizes in aFamily/aFace/aStyle
  2532      on this display.
  2632      on this display.
  2533      But only those matching filter (if nonNIl)."
  2633      But only those matching filter (if nonNIl)."
  2534 
  2634 
  2535     |allFonts sizes "family face style size"|
  2635     |fonts|
  2536 
  2636 
  2537     allFonts := self listOfAvailableFonts.
  2637     fonts := self fontsInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
  2538     allFonts isNil ifTrue:[^ nil].
  2638     fonts size == 0 ifTrue:[^ nil].
  2539 
  2639 
  2540     sizes := Set new.
  2640     ^ fonts collect:[:descr | descr size].
  2541     allFonts do:[:fntDescr |
       
  2542         (aFamilyName = fntDescr family) ifTrue:[
       
  2543             (aFaceName = fntDescr face) ifTrue:[
       
  2544                 (aStyleName = fntDescr style) ifTrue:[
       
  2545                     (filter isNil or:[filter value:fntDescr]) ifTrue:[
       
  2546                         sizes add:fntDescr size
       
  2547                     ]    
       
  2548                 ]
       
  2549             ]
       
  2550         ]
       
  2551     ].
       
  2552     ^ sizes
       
  2553 
  2641 
  2554     "
  2642     "
  2555      Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f |
  2643      Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f |
  2556         f encoding notNil and:[f encoding startsWith:'jis']]
  2644         f encoding notNil and:[f encoding startsWith:'jis']]
  2557     "
  2645     "
  2558 
  2646 
  2559     "Created: 27.2.1996 / 01:37:56 / cg"
  2647     "Created: 27.2.1996 / 01:37:56 / cg"
       
  2648     "Modified: 29.2.1996 / 04:26:52 / cg"
  2560 !
  2649 !
  2561 
  2650 
  2562 stylesInFamily:aFamilyName face:aFaceName
  2651 stylesInFamily:aFamilyName face:aFaceName
  2563     "return a set of all available font styles in aFamily/aFace on this display"
  2652     "return a set of all available font styles in aFamily/aFace on this display"
  2564 
  2653 
  2574 
  2663 
  2575 stylesInFamily:aFamilyName face:aFaceName filtering:filter
  2664 stylesInFamily:aFamilyName face:aFaceName filtering:filter
  2576     "return a set of all available font styles in aFamily/aFace on this display.
  2665     "return a set of all available font styles in aFamily/aFace on this display.
  2577      But only thise matching filter (if nonNil)."
  2666      But only thise matching filter (if nonNil)."
  2578 
  2667 
  2579     |allFonts styles "family face style"|
  2668     |fonts|
  2580 
  2669 
  2581     allFonts := self listOfAvailableFonts.
  2670     fonts := self fontsInFamily:aFamilyName face:aFaceName filtering:filter.
  2582     allFonts isNil ifTrue:[^ nil].
  2671     fonts size == 0 ifTrue:[^ nil].
  2583 
  2672 
  2584     styles := Set new.
  2673     ^ (fonts collect:[:descr | descr style]) asSortedCollection
  2585     allFonts do:[:fntDescr |
       
  2586         (aFamilyName = fntDescr family) ifTrue:[
       
  2587             (aFaceName = fntDescr face) ifTrue:[
       
  2588                 (filter isNil or:[filter value:fntDescr]) ifTrue:[
       
  2589                     styles add:fntDescr style
       
  2590                 ]
       
  2591             ]
       
  2592         ]
       
  2593     ].
       
  2594     ^ styles asSortedCollection
       
  2595 
  2674 
  2596     "
  2675     "
  2597      Display stylesInFamily:'fixed' face:'medium' filtering:[:f |
  2676      Display stylesInFamily:'fixed' face:'medium' filtering:[:f |
  2598         f encoding notNil and:[f encoding startsWith:'jis']]
  2677         f encoding notNil and:[f encoding startsWith:'jis']]
  2599     "
  2678     "
  2600 
  2679 
  2601     "Created: 27.2.1996 / 01:35:22 / cg"
  2680     "Created: 27.2.1996 / 01:35:22 / cg"
       
  2681     "Modified: 29.2.1996 / 04:33:59 / cg"
  2602 !
  2682 !
  2603 
  2683 
  2604 widthOf:aString from:index1 to:index2 inFont:aFontId
  2684 widthOf:aString from:index1 to:index2 inFont:aFontId
  2605     "return the width in pixels of a substring in a specific font"
  2685     "return the width in pixels of a substring in a specific font"
  2606 
  2686 
  3880 ! !
  3960 ! !
  3881 
  3961 
  3882 !DeviceWorkstation class methodsFor:'documentation'!
  3962 !DeviceWorkstation class methodsFor:'documentation'!
  3883 
  3963 
  3884 version
  3964 version
  3885     ^ '$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.73 1996-02-28 18:54:10 cg Exp $'
  3965     ^ '$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.74 1996-02-29 03:49:45 cg Exp $'
  3886 ! !
  3966 ! !
  3887 DeviceWorkstation initialize!
  3967 DeviceWorkstation initialize!