Bug 23757

Summary: Add mode="delete" to <edit>
Product: fontconfig Reporter: Behdad Esfahbod <freedesktop>
Component: libraryAssignee: Akira TAGOH <akira>
Status: RESOLVED FIXED QA Contact: Behdad Esfahbod <freedesktop>
Severity: enhancement    
Priority: medium CC: akira, fontconfig-bugs
Version: 2.4   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Behdad Esfahbod 2009-09-06 19:02:43 UTC
Currently one can't delete an element value.  Should add mode="delete" and mode="delete_all".
Comment 1 Akira TAGOH 2012-03-28 03:41:33 UTC
assuming that "delete" is to delete the specific value in the object from the pattern and "delete_all" to delete all of values in the object from the pattern so that the syntax of <edit> requires the object name? so if I want to delete "ja" from the lang object if any:

<edit name="lang" mode="delete">
  <string>ja</string>
</edit>

and to delete everything:

<edit name="lang" mode="delete_all"/> ?
Comment 2 Akira TAGOH 2013-01-29 11:23:39 UTC
proposed changes:
  http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz23757

commit d95aee42d952fe11f3cc173d1d94ae19f0053af2
Author: Akira TAGOH <akira@tagoh.org>
Date:   Tue Jan 29 20:19:36 2013 +0900

    Bug 23757 - Add mode="delete" to <edit>
    
    Add two edit mode, "delete" and "delete_all".
    what values are being deleted depends on <test> as documented.
    if the target object is same to what is tested, matching value there
    will be deleted. otherwise all of values in the object will be deleted.
    so this would means both edit mode will not take any expressions.
    
    e.g.
    
    Given that the testing is always true here, the following rules:
    
      <match>
        <test name="foo" compare="eq">
          <string>bar</string>
        </test>
        <edit name="foo" mode="delete"/>
      </match>
    
    will removes "bar" string from "foo" object. and:
    
      <match>
        <test name="foo" compare="eq">
          <string>foo</string>
        </test>
        <edit name="bar" mode="delete"/>
      </match>
    
    will removes all of values in "bar" object.
Comment 3 Akira TAGOH 2013-02-01 05:27:13 UTC
committed into master.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.